djangocms_blog.models

Models

class djangocms_blog.models.Post(*args, **kwargs)

Blog post

exception DoesNotExist
exception MultipleObjectsReturned
_metadata = {'description': 'get_description', 'expiration_time': 'date_published_end', 'image': 'get_image_full_url', 'image_height': 'get_image_height', 'image_width': 'get_image_width', 'keywords': 'get_keywords', 'locale': 'get_locale', 'modified_time': 'date_modified', 'object_type': 'get_meta_attribute', 'og_app_id': 'get_meta_attribute', 'og_author': 'get_meta_attribute', 'og_author_url': 'get_meta_attribute', 'og_description': 'get_description', 'og_profile_id': 'get_meta_attribute', 'og_publisher': 'get_meta_attribute', 'og_type': 'get_meta_attribute', 'published_time': 'date_published', 'schemaorg_description': 'get_description', 'schemaorg_type': 'get_meta_attribute', 'tag': 'get_tags', 'title': 'get_title', 'twitter_author': 'get_meta_attribute', 'twitter_description': 'get_description', 'twitter_site': 'get_meta_attribute', 'twitter_type': 'get_meta_attribute', 'url': 'get_absolute_url'}

Metadata configuration dictionary

_metadata dict values can be:

  • name of object method taking the field name as parameter

  • name of object method taking no parameters

  • name of object attribute

  • name of callable taking the field name as parameter

  • name of callable taking no parameters

  • literal value

They are checked in the given order: the first that matches is returned.

Callable must be available in the module (i.e.: imported if not defined in the module itself)

_parler_meta: ParlerOptions = <ParlerOptions: Post.translations to PostTranslation>

Access to the metadata of the translatable model :type: ParlerOptions

get_author()

Return the author (user) objects

get_keywords()

Returns the list of keywords (as python list) :return: list

get_tags()

Returns the list of object tags as comma separated list

property is_published

Checks wether the blog post is really published by checking publishing dates too

save(*args, **kwargs)

Handle some auto configuration during save

save_translation(translation, *args, **kwargs)

Handle some auto configuration during save

should_knock(signal_type, created=False)

Returns whether to emit knocks according to the post state

class djangocms_blog.models.BlogCategory(*args, **kwargs)

Blog category

exception DoesNotExist
exception MultipleObjectsReturned
_metadata = {'description': 'get_description', 'locale': 'get_locale', 'object_type': 'get_meta_attribute', 'og_app_id': 'get_meta_attribute', 'og_author': 'get_meta_attribute', 'og_author_url': 'get_meta_attribute', 'og_description': 'get_description', 'og_profile_id': 'get_meta_attribute', 'og_publisher': 'get_meta_attribute', 'og_type': 'get_meta_attribute', 'schemaorg_description': 'get_description', 'schemaorg_type': 'get_meta_attribute', 'title': 'get_title', 'twitter_author': 'get_meta_attribute', 'twitter_description': 'get_description', 'twitter_site': 'get_meta_attribute', 'twitter_type': 'get_meta_attribute', 'url': 'get_absolute_url'}

Metadata configuration dictionary

_metadata dict values can be:

  • name of object method taking the field name as parameter

  • name of object method taking no parameters

  • name of object attribute

  • name of callable taking the field name as parameter

  • name of callable taking no parameters

  • literal value

They are checked in the given order: the first that matches is returned.

Callable must be available in the module (i.e.: imported if not defined in the module itself)

_parler_meta: ParlerOptions = <ParlerOptions: BlogCategory.translations to BlogCategoryTranslation>

Access to the metadata of the translatable model :type: ParlerOptions

save(*args, **kwargs)

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

class djangocms_blog.models.BlogMetaMixin
get_full_url()

Return the url with protocol and domain url

get_meta_attribute(param)

Retrieves django-meta attributes from apphook config instance :param param: django-meta attribute passed as key

Managers

class djangocms_blog.managers.GenericDateQuerySet(*args, **kwargs)
class djangocms_blog.managers.GenericDateTaggedManager(*args, **kwargs)
get_months(queryset=None, current_site=True)

Get months with aggregate count (how much posts is in the month). Results are ordered by date.

get_queryset(*args, **kwargs)

Return a new QuerySet object. Subclasses can override this method to customize the behavior of the Manager.

queryset_class

alias of GenericDateQuerySet