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
  • start_publication (DateTimeField) – Start date of publication.
  • end_publication (DateTimeField) – End date of publication.
  • creation_date (DateTimeField) – Used to build the entry’s URL.
  • 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
  • excerpt (TextField) – Optional element.
  • image (ImageField) – Used for illustration.
  • 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
Entry.categories
Entry.get_absolute_url(*moreargs, **morekwargs)

Builds and returns the entry’s URL based on the slug and the creation date.

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_previous_by_creation_date(*moreargs, **morekwargs)
Entry.get_previous_by_last_update(*moreargs, **morekwargs)
Entry.get_status_display(*moreargs, **morekwargs)
Entry.objects = <django.db.models.manager.Manager object>
Entry.published = <zinnia.managers.EntryPublishedManager object>
Entry.related
Entry.sites
class zinnia.models.Author(*args, **kwargs)

Bases: django.contrib.auth.models.User

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. 30 characters or fewer. Letters, numbers and @/./+/-/_ characters
  • 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
Author.entries_published()

Returns author’s published entries.

Author.get_absolute_url(*moreargs, **morekwargs)

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

Author.objects = <django.contrib.auth.models.UserManager object>
Author.published = <zinnia.managers.EntryRelatedPublishedManager object>
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
Category.entries
Category.entries_published()

Returns category’s published entries.

Category.get_absolute_url(*moreargs, **morekwargs)

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

Category.objects = <mptt.managers.TreeManager object>
Category.parent
Category.published = <zinnia.managers.EntryRelatedPublishedManager object>
Category.tree = <mptt.managers.TreeManager object>
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

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. 30 characters or fewer. Letters, numbers and @/./+/-/_ characters
  • 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
Author.entries_published()

Returns author’s published entries.

Author.get_absolute_url(*moreargs, **morekwargs)

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

Author.objects = <django.contrib.auth.models.UserManager object>
Author.published = <zinnia.managers.EntryRelatedPublishedManager object>

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
Category.entries
Category.entries_published()

Returns category’s published entries.

Category.get_absolute_url(*moreargs, **morekwargs)

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

Category.objects = <mptt.managers.TreeManager object>
Category.parent
Category.published = <zinnia.managers.EntryRelatedPublishedManager object>
Category.tree = <mptt.managers.TreeManager object>
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
  • start_publication (DateTimeField) – Start date of publication.
  • end_publication (DateTimeField) – End date of publication.
  • creation_date (DateTimeField) – Used to build the entry’s URL.
  • 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
  • excerpt (TextField) – Optional element.
  • image (ImageField) – Used for illustration.
  • 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
Entry.categories
Entry.get_absolute_url(*moreargs, **morekwargs)

Builds and returns the entry’s URL based on the slug and the creation date.

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_previous_by_creation_date(*moreargs, **morekwargs)
Entry.get_previous_by_last_update(*moreargs, **morekwargs)
Entry.get_status_display(*moreargs, **morekwargs)
Entry.objects = <django.db.models.manager.Manager object>
Entry.published = <zinnia.managers.EntryPublishedManager object>
Entry.related
Entry.sites