models Package¶
models
Package¶
Models for Zinnia
-
class
zinnia.models.
Entry
(*args, **kwargs)¶ Bases:
zinnia.models_bases.entry.AbstractEntry
The final Entry model based on inheritence.
Parameters: - id (AutoField) – Id
- title (CharField) – Title
- slug (SlugField) – Used to build the entry’s URL.
- status (IntegerField) – Status
- publication_date (DateTimeField) – Used to build the entry’s URL.
- start_publication (DateTimeField) – Start date of publication.
- end_publication (DateTimeField) – End date of publication.
- creation_date (DateTimeField) – Creation date
- last_update (DateTimeField) – Last update
- content (TextField) – Content
- comment_enabled (BooleanField) – Allows comments if checked.
- pingback_enabled (BooleanField) – Allows pingbacks if checked.
- trackback_enabled (BooleanField) – Allows trackbacks if checked.
- comment_count (IntegerField) – Comment count
- pingback_count (IntegerField) – Pingback count
- trackback_count (IntegerField) – Trackback count
- lead (TextField) – Lead paragraph
- excerpt (TextField) – Used for SEO purposes.
- image (ImageField) – Used for illustration.
- image_caption (TextField) – Image’s caption.
- featured (BooleanField) – Featured
- tags (TagField) – Tags
- login_required (BooleanField) – Only authenticated users can view the entry.
- password (CharField) – Protects the entry with a password.
- content_template (CharField) – Template used to display the entry’s content.
- detail_template (CharField) – Template used to display the entry’s detail page.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
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.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
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.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
get_content_template_display
(*moreargs, **morekwargs)¶
-
get_detail_template_display
(*moreargs, **morekwargs)¶
-
get_next_by_creation_date
(*moreargs, **morekwargs)¶
-
get_next_by_last_update
(*moreargs, **morekwargs)¶
-
get_next_by_publication_date
(*moreargs, **morekwargs)¶
-
get_previous_by_creation_date
(*moreargs, **morekwargs)¶
-
get_previous_by_last_update
(*moreargs, **morekwargs)¶
-
get_previous_by_publication_date
(*moreargs, **morekwargs)¶
-
get_status_display
(*moreargs, **morekwargs)¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
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.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
class
zinnia.models.
Author
(*args, **kwargs)¶ Bases:
django.contrib.auth.models.User
,zinnia.models.author.AuthorPublishedManager
Proxy model around
django.contrib.auth.models.get_user_model
.Parameters: - id (AutoField) – Id
- password (CharField) – Password
- last_login (DateTimeField) – Last login
- is_superuser (BooleanField) – Designates that this user has all permissions without explicitly assigning them.
- username (CharField) – Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.
- first_name (CharField) – First name
- last_name (CharField) – Last name
- email (EmailField) – Email address
- is_staff (BooleanField) – Designates whether the user can log into this admin site.
- is_active (BooleanField) – Designates whether this user should be treated as active. Unselect this instead of deleting accounts.
- date_joined (DateTimeField) – Date joined
-
exception
DoesNotExist
¶ Bases:
django.contrib.auth.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.contrib.auth.models.MultipleObjectsReturned
-
entries
¶ 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.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
entries_published
()¶ Returns author’s published entries.
-
get_absolute_url
()¶ Builds and returns the author’s URL based on his username.
-
class
zinnia.models.
Category
(*args, **kwargs)¶ Bases:
mptt.models.MPTTModel
Simple model for categorizing entries.
Parameters: - id (AutoField) – Id
- title (CharField) – Title
- slug (SlugField) – Used to build the category’s URL.
- description (TextField) – Description
- parent_id (TreeForeignKey) – Parent category
- lft (PositiveIntegerField) – Lft
- rght (PositiveIntegerField) – Rght
- tree_id (PositiveIntegerField) – Tree id
- level (PositiveIntegerField) – Level
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
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.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
description
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
entries
¶ 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.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
entries_published
()¶ Returns category’s published entries.
-
get_absolute_url
()¶ Builds and returns the category’s URL based on his tree path.
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
level
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
lft
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <mptt.managers.TreeManager object>¶
-
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.parent
is aForwardManyToOneDescriptor
instance.
-
parent_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
published
= <zinnia.managers.EntryRelatedPublishedManager object>¶
-
rght
¶ 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.
-
title
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
tree_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
tree_path
¶ Returns category’s tree path by concatening the slug of his ancestors.
author
Module¶
Author model for Zinnia
Bases:
django.contrib.auth.models.User
,zinnia.models.author.AuthorPublishedManager
Proxy model around
django.contrib.auth.models.get_user_model
.Parameters: - id (AutoField) – Id
- password (CharField) – Password
- last_login (DateTimeField) – Last login
- is_superuser (BooleanField) – Designates that this user has all permissions without explicitly assigning them.
- username (CharField) – Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.
- first_name (CharField) – First name
- last_name (CharField) – Last name
- email (EmailField) – Email address
- is_staff (BooleanField) – Designates whether the user can log into this admin site.
- is_active (BooleanField) – Designates whether this user should be treated as active. Unselect this instead of deleting accounts.
- date_joined (DateTimeField) – Date joined
Bases:
django.contrib.auth.models.DoesNotExist
Bases:
django.contrib.auth.models.MultipleObjectsReturned
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.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
Returns author’s published entries.
Builds and returns the author’s URL based on his username.
Bases:
django.db.models.base.Model
Proxy model manager to avoid overriding of the default User’s manager and issue #307.
Safe loading of the User model, customized or not.
category
Module¶
Category model for Zinnia
-
class
zinnia.models.category.
Category
(*args, **kwargs)¶ Bases:
mptt.models.MPTTModel
Simple model for categorizing entries.
Parameters: - id (AutoField) – Id
- title (CharField) – Title
- slug (SlugField) – Used to build the category’s URL.
- description (TextField) – Description
- parent_id (TreeForeignKey) – Parent category
- lft (PositiveIntegerField) – Lft
- rght (PositiveIntegerField) – Rght
- tree_id (PositiveIntegerField) – Tree id
- level (PositiveIntegerField) – Level
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
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.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
description
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
entries
¶ 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.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
entries_published
()¶ Returns category’s published entries.
-
get_absolute_url
()¶ Builds and returns the category’s URL based on his tree path.
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
level
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
lft
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <mptt.managers.TreeManager object>¶
-
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.parent
is aForwardManyToOneDescriptor
instance.
-
parent_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
published
= <zinnia.managers.EntryRelatedPublishedManager object>¶
-
rght
¶ 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.
-
title
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
tree_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
tree_path
¶ Returns category’s tree path by concatening the slug of his ancestors.
entry
Module¶
Entry model for Zinnia
-
class
zinnia.models.entry.
Entry
(*args, **kwargs)¶ Bases:
zinnia.models_bases.entry.AbstractEntry
The final Entry model based on inheritence.
Parameters: - id (AutoField) – Id
- title (CharField) – Title
- slug (SlugField) – Used to build the entry’s URL.
- status (IntegerField) – Status
- publication_date (DateTimeField) – Used to build the entry’s URL.
- start_publication (DateTimeField) – Start date of publication.
- end_publication (DateTimeField) – End date of publication.
- creation_date (DateTimeField) – Creation date
- last_update (DateTimeField) – Last update
- content (TextField) – Content
- comment_enabled (BooleanField) – Allows comments if checked.
- pingback_enabled (BooleanField) – Allows pingbacks if checked.
- trackback_enabled (BooleanField) – Allows trackbacks if checked.
- comment_count (IntegerField) – Comment count
- pingback_count (IntegerField) – Pingback count
- trackback_count (IntegerField) – Trackback count
- lead (TextField) – Lead paragraph
- excerpt (TextField) – Used for SEO purposes.
- image (ImageField) – Used for illustration.
- image_caption (TextField) – Image’s caption.
- featured (BooleanField) – Featured
- tags (TagField) – Tags
- login_required (BooleanField) – Only authenticated users can view the entry.
- password (CharField) – Protects the entry with a password.
- content_template (CharField) – Template used to display the entry’s content.
- detail_template (CharField) – Template used to display the entry’s detail page.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
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.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
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.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
get_content_template_display
(*moreargs, **morekwargs)¶
-
get_detail_template_display
(*moreargs, **morekwargs)¶
-
get_next_by_creation_date
(*moreargs, **morekwargs)¶
-
get_next_by_last_update
(*moreargs, **morekwargs)¶
-
get_next_by_publication_date
(*moreargs, **morekwargs)¶
-
get_previous_by_creation_date
(*moreargs, **morekwargs)¶
-
get_previous_by_last_update
(*moreargs, **morekwargs)¶
-
get_previous_by_publication_date
(*moreargs, **morekwargs)¶
-
get_status_display
(*moreargs, **morekwargs)¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
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.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.