Models¶
Database models for djangocms-stories.
Core Models¶
Post¶
- class Post(*args, **kwargs)[source]¶
Bases:
ModelRepresents a blog post or story entry with multilingual content, images, categories, tags, and publication metadata. It is the “grouper model” for
PostContent.This model supports translation, site-specific publishing, image handling, tagging, and flexible URL generation for posts.
- author¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- date_created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_modified¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_published¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_published_end¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_featured¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- include_in_rss¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- categories¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- main_image¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- main_image_thumbnail¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- main_image_full¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- enable_comments¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- sites¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- app_config¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- tags = <taggit.managers._TaggableManager object>¶
- objects = <djangocms_stories.managers.GenericDateTaggedManager object>¶
- safe_translation_getter(field, default=None, language_code=None, any_language=False, show_draft_content=False)[source]¶
Fetch a content property, and return a default value when both the translation and fallback language are missing.
When
any_language=Trueis used, the function also looks into other languages to find a suitable value. This feature can be useful for “title” attributes for example, to make sure there is at least something being displayed. Also consider usingfield = TranslatedField(any_language=True)in the model itself, to make this behavior the default for the given field.
- property guid¶
- property date¶
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- app_config_id¶
- author_id¶
- featuredpostsplugin_set¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- get_next_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=True, **kwargs)¶
- get_next_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=True, **kwargs)¶
- get_previous_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=False, **kwargs)¶
- get_previous_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- main_image_full_id¶
- main_image_id¶
- main_image_thumbnail_id¶
- post_set¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- postcontent_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- tagged_items¶
Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.commentsis a ReverseGenericManyToOneDescriptor instance.
PostContent¶
- class PostContent(id, post, language, title, slug, subtitle, abstract, meta_description, meta_keywords, meta_title, post_text)[source]¶
Bases:
PostMetaMixin,ModelMeta,Model- structure_template = 'post_detail.html'¶
- no_structure_template = 'no_post_structure.html'¶
- post¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- language¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- title¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- slug¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- subtitle¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- abstract¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- meta_description¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- meta_keywords¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- meta_title¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- post_text¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- placeholders¶
Accessor to the related objects manager on the one-to-many relation created by GenericRelation.
In the example:
class Post(Model): comments = GenericRelation(Comment)
post.commentsis a ReverseGenericManyToOneDescriptor instance.
- objects = <djangocms_stories.managers.SiteManager object>¶
- admin_manager = <djangocms_stories.managers.AdminManager object>¶
- property author¶
- property date_published¶
- property date_published_end¶
- property date_modified¶
- property app_config¶
- property categories¶
- media¶
- content¶
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- post_id¶
Category Models¶
PostCategory¶
- class PostCategory(*args, **kwargs)[source]¶
Bases:
PostMetaMixin,ModelMeta,TranslatableModelPost category allows to structure content in a hierarchy of categories.
- parent¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- date_created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- date_modified¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- app_config¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- priority¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- main_image¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- main_image_thumbnail¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- main_image_full¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- translations¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- linked_posts¶
returns all linked posts in the same appconfig namespace
- count¶
- count_all_sites¶
- get_absolute_url(lang=None)[source]¶
Returns the absolute URL for the category overview in the specified language. If the category has a translation in the given language, returns the URL for the category’s detail page using its slug. If the category does not exist in the specified language, falls back to the URL for the latest posts. :param lang: The language code to use for the URL. If not provided, determines the language automatically. :type lang: str, optional
- Returns:
The absolute URL for the category or the latest posts, depending on translation availability.
- Return type:
str
- save(*args, **kwargs)[source]¶
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.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- abstract¶
Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
- app_config_id¶
- children¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- get_next_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=True, **kwargs)¶
- get_next_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=True, **kwargs)¶
- get_previous_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=False, **kwargs)¶
- get_previous_by_date_modified(*, field=<django.db.models.fields.DateTimeField: date_modified>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- latestpostsplugin_set¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- main_image_full_id¶
- main_image_id¶
- main_image_thumbnail_id¶
- meta_description¶
Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
- name¶
Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
- parent_id¶
- posts¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- slug¶
Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
Configuration Models¶
StoriesConfig¶
- class StoriesConfig(*args, **kwargs)[source]¶
Bases:
TranslatableModelClass representing a stories configuration.
This class inherits from TranslatableModel.
- type¶
Represents the type of the stories config.
- Type:
models.CharField
- namespace¶
Represents the namespace of the instance.
- Type:
models.CharField
- translations¶
Represents the translated fields of the stories config.
- Type:
TranslatedFields
- default_image_full¶
Represents the default size of full images.
- Type:
models.ForeignKey
- default_image_thumbnail¶
Represents the default size of thumbnail images.
- Type:
models.ForeignKey
- url_patterns¶
Represents the structure of permalinks.
- Type:
models.CharField
- use_placeholder¶
Represents whether to use placeholder and plugins for article body.
- Type:
models.BooleanField
- use_abstract¶
Represents whether to use abstract field.
- Type:
models.BooleanField
Represents whether to enable related posts.
- Type:
models.SmallIntegerField
- urlconf¶
Represents the URL config.
- Type:
models.CharField
- set_author¶
Represents whether to set author by default.
- Type:
models.BooleanField
- paginate_by¶
Represents the number of articles per page for pagination.
- Type:
models.SmallIntegerField
- template_prefix¶
Represents the alternative directory to load the stories templates from.
- Type:
models.CharField
Represents the menu structure.
- Type:
models.CharField
Represents whether to show empty categories in menu.
- Type:
models.BooleanField
- sitemap_changefreq¶
Represents the changefreq attribute for sitemap items.
- Type:
models.CharField
- sitemap_priority¶
Represents the priority attribute for sitemap items.
- Type:
models.DecimalField
- object_type¶
Represents the object type.
- Type:
models.CharField
- og_type¶
Represents the Facebook type.
- Type:
models.CharField
- og_app_id¶
Represents the Facebook application ID.
- Type:
models.CharField
- og_profile_id¶
Represents the Facebook profile ID.
- Type:
models.CharField
- og_publisher¶
Represents the Facebook page URL.
- Type:
models.CharField
- og_author_url¶
Represents the Facebook author URL.
- Type:
models.CharField
- og_author¶
Represents the Facebook author.
- Type:
models.CharField
- twitter_type¶
Represents the Twitter type field.
- Type:
models.CharField
- twitter_site¶
Represents the Twitter site handle.
- Type:
models.CharField
- twitter_author¶
Represents the Twitter author handle.
- Type:
models.CharField
- gplus_type¶
Represents the Schema.org object type.
- Type:
models.CharField
- gplus_author¶
Represents the Schema.org author name abstract field.
- Type:
models.CharField
- type¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- namespace¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- translations¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- default_image_full¶
Default size of full images
- default_image_thumbnail¶
Default size of thumbnail images
- url_patterns¶
Structure of permalinks (get_absolute_url); see AVAILABLE_PERMALINK_STYLES
- use_placeholder¶
-
- Type:
Use placeholder and plugins for article body (default
- use_abstract¶
-
- Type:
Use abstract field (default
- use_related¶
-
- Type:
Enable related posts (default
- set_author¶
-
- Type:
Set author by default (default
- paginate_by¶
-
- Type:
When paginating list views, how many articles per page? (default
- template_prefix¶
“”)
- Type:
Alternative directory to load the stories templates from (default
- menu_structure¶
MENU_TYPE_COMPLETE, see MENU_TYPES)- Type:
Menu structure (default
- menu_empty_categories¶
-
- Type:
Show empty categories in menu (default
- sitemap_changefreq¶
SITEMAP_CHANGEFREQ_DEFAULT, see: SITEMAP_CHANGEFREQ)
- Type:
Sitemap changefreq (default
- sitemap_priority¶
-
- Type:
Sitemap priority (default
- og_app_id¶
-
- Type:
Facebook application ID (default
- og_profile_id¶
-
- Type:
Facebook profile ID (default
- og_publisher¶
-
- Type:
Facebook page URL (default
- og_author_url¶
-
- Type:
Facebook author URL (default
- twitter_type¶
-
- Type:
Twitter type field (default
- twitter_site¶
-
- Type:
Twitter site handle (default
- twitter_author¶
-
- Type:
Twitter author handle (default
- gplus_type¶
-
- Type:
Schema.org object type (default
- gplus_author¶
-
- Type:
Schema.org author name abstract field (default
- send_knock_create¶
Send notifications on post update. Requires channels integration
- send_knock_update¶
Send notifications on post update. Requires channels integration
- property schemaorg_type¶
Compatibility shim to fetch data from legacy gplus_type field.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- app_title¶
Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
- authorentriesplugin_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- default_image_full_id¶
- default_image_thumbnail_id¶
- featuredpostsplugin_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- genericblogplugin_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- latestpostsplugin_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- object_name¶
Descriptor for translated attributes.
This attribute proxies all get/set calls to the translated model.
- post_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- postcategory_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.