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

Bases: django.core.exceptions.ObjectDoesNotExist

exception Entry.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Entry.authors

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 and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Entry.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 and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Entry.get_content_template_display(*moreargs, **morekwargs)
Entry.get_detail_template_display(*moreargs, **morekwargs)
Entry.get_next_by_creation_date(*moreargs, **morekwargs)
Entry.get_next_by_last_update(*moreargs, **morekwargs)
Entry.get_next_by_publication_date(*moreargs, **morekwargs)
Entry.get_previous_by_creation_date(*moreargs, **morekwargs)
Entry.get_previous_by_last_update(*moreargs, **morekwargs)
Entry.get_previous_by_publication_date(*moreargs, **morekwargs)
Entry.get_status_display(*moreargs, **morekwargs)
Entry.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Entry.related

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 and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Entry.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 and topping.pizzas are ManyToManyDescriptor 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 Author.MultipleObjectsReturned

Bases: django.contrib.auth.models.MultipleObjectsReturned

Author.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 and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Author.entries_published()

Returns author’s published entries.

Author.get_absolute_url(*args, **kwargs)

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

Bases: django.core.exceptions.ObjectDoesNotExist

exception Category.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Category.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 a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Category.description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.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 and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Category.entries_published()

Returns category’s published entries.

Category.get_absolute_url(*args, **kwargs)

Builds and returns the category’s URL based on his tree path.

Category.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.level

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.lft

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.objects = <mptt.managers.TreeManager object>
Category.parent

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Category.parent_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.published = <zinnia.managers.EntryRelatedPublishedManager object>
Category.rght

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.slug

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.title

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.tree_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.tree_path

Returns category’s tree path by concatening the slug of his ancestors.

author Module

Author model for Zinnia

class zinnia.models.author.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 Author.MultipleObjectsReturned

Bases: django.contrib.auth.models.MultipleObjectsReturned

Author.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 and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Author.entries_published()

Returns author’s published entries.

Author.get_absolute_url(*args, **kwargs)

Builds and returns the author’s URL based on his username.

class zinnia.models.author.AuthorPublishedManager(*args, **kwargs)

Bases: django.db.models.base.Model

Proxy model manager to avoid overriding of the default User’s manager and issue #307.

class Meta
abstract = False
AuthorPublishedManager.published
zinnia.models.author.safe_get_user_model()

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

Bases: django.core.exceptions.ObjectDoesNotExist

exception Category.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Category.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 a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Category.description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.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 and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Category.entries_published()

Returns category’s published entries.

Category.get_absolute_url(*args, **kwargs)

Builds and returns the category’s URL based on his tree path.

Category.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.level

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.lft

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.objects = <mptt.managers.TreeManager object>
Category.parent

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Category.parent_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.published = <zinnia.managers.EntryRelatedPublishedManager object>
Category.rght

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.slug

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.title

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.tree_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.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

Bases: django.core.exceptions.ObjectDoesNotExist

exception Entry.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Entry.authors

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 and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Entry.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 and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Entry.get_content_template_display(*moreargs, **morekwargs)
Entry.get_detail_template_display(*moreargs, **morekwargs)
Entry.get_next_by_creation_date(*moreargs, **morekwargs)
Entry.get_next_by_last_update(*moreargs, **morekwargs)
Entry.get_next_by_publication_date(*moreargs, **morekwargs)
Entry.get_previous_by_creation_date(*moreargs, **morekwargs)
Entry.get_previous_by_last_update(*moreargs, **morekwargs)
Entry.get_previous_by_publication_date(*moreargs, **morekwargs)
Entry.get_status_display(*moreargs, **morekwargs)
Entry.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Entry.related

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 and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Entry.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 and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.