views Package

views Package

Views for Zinnia

authors Module

Views for Zinnia authors

class zinnia.views.authors.AuthorDetail(**kwargs)

Bases: zinnia.views.mixins.templates.EntryQuerysetTemplateResponseMixin, zinnia.views.mixins.prefetch_related.PrefetchCategoriesAuthorsMixin, zinnia.views.authors.BaseAuthorDetail, django.views.generic.list.BaseListView

Detailed view for an Author combinating these mixins:

  • EntryQuerysetTemplateResponseMixin to provide custom templates for the author display page.
  • PrefetchCategoriesAuthorsMixin to prefetch related Categories and Authors to belonging the entry list.
  • BaseAuthorDetail to provide the behavior of the view.
  • BaseListView to implement the ListView.
get_model_name()

The model name is the author’s username.

model_type = 'author'
paginate_by = 10
class zinnia.views.authors.AuthorList(**kwargs)

Bases: django.views.generic.list.ListView

View returning a list of all published authors.

get_queryset()

Return a queryset of published authors, with a count of their entries published.

class zinnia.views.authors.BaseAuthorDetail

Bases: object

Mixin providing the behavior of the author detail view, by returning in the context the current author and a queryset containing the entries written by author.

get_context_data(**kwargs)

Add the current author in context.

get_queryset()

Retrieve the author by his username and build a queryset of his published entries.

archives Module

Views for Zinnia archives

class zinnia.views.archives.EntryArchiveMixin

Bases: zinnia.views.mixins.archives.ArchiveMixin, zinnia.views.mixins.archives.PreviousNextPublishedMixin, zinnia.views.mixins.prefetch_related.PrefetchCategoriesAuthorsMixin, zinnia.views.mixins.callable_queryset.CallableQuerysetMixin, zinnia.views.mixins.templates.EntryQuerysetArchiveTemplateResponseMixin

Mixin combinating:

  • ArchiveMixin configuration centralizing conf for archive views.
  • PrefetchCategoriesAuthorsMixin to prefetch related objects.
  • PreviousNextPublishedMixin for returning published archives.
  • CallableQueryMixin to force the update of the queryset.
  • EntryQuerysetArchiveTemplateResponseMixin to provide a custom templates for archives.
classmethod queryset()
class zinnia.views.archives.EntryDay(**kwargs)

Bases: zinnia.views.mixins.tz_fixes.EntryDayTZFix, zinnia.views.archives.EntryArchiveMixin, django.views.generic.dates.BaseDayArchiveView

View returning the archive for a day.

template_name_suffix = '_archive_day'
class zinnia.views.archives.EntryIndex(**kwargs)

Bases: zinnia.views.archives.EntryArchiveMixin, zinnia.views.mixins.templates.EntryQuerysetArchiveTodayTemplateResponseMixin, django.views.generic.dates.BaseArchiveIndexView

View returning the archive index.

context_object_name = 'entry_list'
class zinnia.views.archives.EntryMonth(**kwargs)

Bases: zinnia.views.mixins.tz_fixes.EntryMonthTZFix, zinnia.views.archives.EntryArchiveMixin, django.views.generic.dates.BaseMonthArchiveView

View returning the archives for a month.

template_name_suffix = '_archive_month'
class zinnia.views.archives.EntryToday(**kwargs)

Bases: zinnia.views.mixins.tz_fixes.EntryDayTZFix, zinnia.views.archives.EntryArchiveMixin, django.views.generic.dates.BaseTodayArchiveView

View returning the archive for the current day.

get_dated_items()

Return (date_list, items, extra_context) for this request. And defines self.year/month/day for EntryQuerysetArchiveTemplateResponseMixin.

template_name_suffix = '_archive_today'
class zinnia.views.archives.EntryWeek(**kwargs)

Bases: zinnia.views.mixins.tz_fixes.EntryWeekTZFix, zinnia.views.archives.EntryArchiveMixin, django.views.generic.dates.BaseWeekArchiveView

View returning the archive for a week.

get_dated_items()

Override get_dated_items to add a useful ‘week_end_day’ variable in the extra context of the view.

template_name_suffix = '_archive_week'
class zinnia.views.archives.EntryYear(**kwargs)

Bases: zinnia.views.archives.EntryArchiveMixin, django.views.generic.dates.BaseYearArchiveView

View returning the archives for a year.

make_object_list = True
template_name_suffix = '_archive_year'

categories Module

Views for Zinnia categories

class zinnia.views.categories.BaseCategoryDetail

Bases: object

Mixin providing the behavior of the category detail view, by returning in the context the current category and a queryset containing the entries published under it.

get_context_data(**kwargs)

Add the current category in context.

get_queryset()

Retrieve the category by his path and build a queryset of her published entries.

class zinnia.views.categories.CategoryDetail(**kwargs)

Bases: zinnia.views.mixins.templates.EntryQuerysetTemplateResponseMixin, zinnia.views.mixins.prefetch_related.PrefetchCategoriesAuthorsMixin, zinnia.views.categories.BaseCategoryDetail, django.views.generic.list.BaseListView

Detailed view for a Category combinating these mixins:

  • EntryQuerysetTemplateResponseMixin to provide custom templates for the category display page.
  • PrefetchCategoriesAuthorsMixin to prefetch related Categories and Authors to belonging the entry list.
  • BaseCategoryDetail to provide the behavior of the view.
  • BaseListView to implement the ListView.
get_model_name()

The model name is the category’s slug.

model_type = 'category'
paginate_by = 10
class zinnia.views.categories.CategoryList(**kwargs)

Bases: django.views.generic.list.ListView

View returning a list of all the categories.

queryset = []
zinnia.views.categories.get_category_or_404(path)

Retrieve a Category instance by a path

capabilities Module

Views for Zinnia capabilities

class zinnia.views.capabilities.CapabilityView(**kwargs)

Bases: zinnia.views.mixins.mimetypes.TemplateMimeTypeView

Base view for the weblog capabilities

get_context_data(**kwargs)

Populate the context of the template with technical informations for building urls

class zinnia.views.capabilities.HumansTxt(**kwargs)

Bases: zinnia.views.capabilities.CapabilityView

http://humanstxt.org/

mimetype = 'text/plain'
template_name = 'zinnia/humans.txt'
class zinnia.views.capabilities.OpenSearchXml(**kwargs)

Bases: zinnia.views.capabilities.CapabilityView

http://www.opensearch.org/

mimetype = 'application/opensearchdescription+xml'
template_name = 'zinnia/opensearch.xml'
class zinnia.views.capabilities.RsdXml(**kwargs)

Bases: zinnia.views.capabilities.CapabilityView

http://en.wikipedia.org/wiki/Really_Simple_Discovery

mimetype = 'application/rsd+xml'
template_name = 'zinnia/rsd.xml'
class zinnia.views.capabilities.WLWManifestXml(**kwargs)

Bases: zinnia.views.capabilities.CapabilityView

http://msdn.microsoft.com/en-us/library/bb463260.aspx

mimetype = 'application/wlwmanifest+xml'
template_name = 'zinnia/wlwmanifest.xml'

channels Module

Views for Zinnia channels

class zinnia.views.channels.BaseEntryChannel

Bases: object

Mixin for displaying a custom selection of entries based on a search query, useful to build SEO/SMO pages aggregating entries on a thematic or for building a custom homepage.

get_context_data(**kwargs)

Add query in context.

get_queryset()

Override the get_queryset method to build the queryset with entry matching query.

query = ''
class zinnia.views.channels.EntryChannel(**kwargs)

Bases: zinnia.views.mixins.prefetch_related.PrefetchCategoriesAuthorsMixin, zinnia.views.channels.BaseEntryChannel, django.views.generic.list.ListView

Channel view for entries combinating these mixins:

  • PrefetchCategoriesAuthorsMixin to prefetch related Categories and Authors to belonging the entry list.
  • BaseEntryChannel to provide the behavior of the view.
  • ListView to implement the ListView and template name resolution.
paginate_by = 10

comments Module

Views for Zinnia comments

class zinnia.views.comments.CommentSuccess(**kwargs)

Bases: django.views.generic.base.TemplateResponseMixin, django.views.generic.base.View

View for handing the publication of a Comment on an Entry. Do a redirection if the comment is visible, else render a confirmation template.

get(request, *args, **kwargs)
get_context_data(**kwargs)
template_name = 'comments/zinnia/entry/posted.html'

entries Module

Views for Zinnia entries

class zinnia.views.entries.EntryDateDetail(**kwargs)

Bases: zinnia.views.mixins.tz_fixes.EntryDateDetailTZFix, zinnia.views.mixins.archives.ArchiveMixin, zinnia.views.mixins.templates.EntryArchiveTemplateResponseMixin, zinnia.views.mixins.callable_queryset.CallableQuerysetMixin, django.views.generic.dates.BaseDateDetailView

Mixin combinating:

  • ArchiveMixin configuration centralizing conf for archive views
  • EntryArchiveTemplateResponseMixin to provide a custom templates depending on the date
  • BaseDateDetailView to retrieve the entry with date and slug
  • CallableQueryMixin to defer the execution of the queryset property when imported
  • EntryDateDetailTZFix for handing the time-zones correctly in Django 1.4.
classmethod queryset()

Return entries published on current site

class zinnia.views.entries.EntryDetail(**kwargs)

Bases: zinnia.views.mixins.entry_protection.EntryProtectionMixin, zinnia.views.entries.EntryDateDetail

Detailled view archive view for an Entry with password and login protections

quick_entry Module

Views for Zinnia quick entry

class zinnia.views.quick_entry.QuickEntry(**kwargs)

Bases: django.views.generic.base.View

View handling the quick post of a short Entry

dispatch(*args, **kwargs)

Decorate the view dispatcher with permission_required

get(request, *args, **kwargs)

GET only do a redirection to the admin for adding and entry

post(request, *args, **kwargs)

Handle the datas for posting a quick entry, and redirect to the admin in case of error or to the entry’s page in case of success

class zinnia.views.quick_entry.QuickEntryForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.util.ErrorList'>, label_suffix=':', empty_permitted=False, instance=None)

Bases: django.forms.models.ModelForm

Form for posting an entry quickly

class Meta
exclude = ('comment_count', 'pingback_count', 'trackback_count')
model

alias of Entry

QuickEntryForm.base_fields = {'title': <django.forms.fields.CharField object at 0x534bc50>, 'slug': <django.forms.fields.SlugField object at 0x534b510>, 'status': <django.forms.fields.TypedChoiceField object at 0x5c00050>, 'start_publication': <django.forms.fields.DateTimeField object at 0x4ab6e10>, 'end_publication': <django.forms.fields.DateTimeField object at 0x494f690>, 'sites': <django.forms.models.ModelMultipleChoiceField object at 0x494f190>, 'creation_date': <django.forms.fields.DateTimeField object at 0x494f650>, 'last_update': <django.forms.fields.DateTimeField object at 0x5c15a90>, 'content': <django.forms.fields.CharField object at 0x5ba03d0>, 'comment_enabled': <django.forms.fields.BooleanField object at 0x5ba01d0>, 'pingback_enabled': <django.forms.fields.BooleanField object at 0x5b83790>, 'trackback_enabled': <django.forms.fields.BooleanField object at 0x5b830d0>, 'related': <django.forms.models.ModelMultipleChoiceField object at 0x508db90>, 'excerpt': <django.forms.fields.CharField object at 0x508db50>, 'image': <django.forms.fields.ImageField object at 0x45d6f90>, 'featured': <django.forms.fields.BooleanField object at 0x45d69d0>, 'authors': <django.forms.models.ModelMultipleChoiceField object at 0x5b90e50>, 'categories': <django.forms.models.ModelMultipleChoiceField object at 0x5b389d0>, 'tags': <tagging.forms.TagField object at 0x5b382d0>, 'login_required': <django.forms.fields.BooleanField object at 0x5b38e10>, 'password': <django.forms.fields.CharField object at 0x5b38390>, 'content_template': <django.forms.fields.TypedChoiceField object at 0x5b38610>, 'detail_template': <django.forms.fields.TypedChoiceField object at 0x5b71090>}
QuickEntryForm.declared_fields = {}
QuickEntryForm.media

search Module

Views for Zinnia entries search

class zinnia.views.search.BaseEntrySearch

Bases: object

Mixin providing the behavior of the entry search view, by returning in the context the pattern searched, the error if something wrong has happened and finally the the queryset of published entries matching the pattern.

error = None
get_context_data(**kwargs)

Add error and pattern in context.

get_queryset()

Overridde the get_queryset method to do some validations and build the search queryset.

pattern = ''
class zinnia.views.search.EntrySearch(**kwargs)

Bases: zinnia.views.mixins.prefetch_related.PrefetchCategoriesAuthorsMixin, zinnia.views.search.BaseEntrySearch, django.views.generic.list.ListView

Search view for entries combinating these mixins:

  • PrefetchCategoriesAuthorsMixin to prefetch related Categories and Authors to belonging the entry list.
  • BaseEntrySearch to provide the behavior of the view.
  • ListView to implement the ListView and template name resolution.
paginate_by = 10
template_name_suffix = '_search'

sitemap Module

Views for Zinnia sitemap

class zinnia.views.sitemap.Sitemap(**kwargs)

Bases: django.views.generic.base.TemplateView

Sitemap view of the blog

get_context_data(**kwargs)

Populate the context of the template with all published entries and all the categories

template_name = 'zinnia/sitemap.html'

tags Module

Views for Zinnia tags

class zinnia.views.tags.BaseTagDetail

Bases: object

Mixin providing the behavior of the tag detail view, by returning in the context the current tag and a queryset containing the entries published with the tag.

get_context_data(**kwargs)

Add the current tag in context.

get_queryset()

Retrieve the tag by his name and build a queryset of his published entries.

class zinnia.views.tags.TagDetail(**kwargs)

Bases: zinnia.views.mixins.templates.EntryQuerysetTemplateResponseMixin, zinnia.views.mixins.prefetch_related.PrefetchCategoriesAuthorsMixin, zinnia.views.tags.BaseTagDetail, django.views.generic.list.BaseListView

Detailed view for a Tag combinating these mixins:

  • EntryQuerysetTemplateResponseMixin to provide custom templates for the tag display page.
  • PrefetchCategoriesAuthorsMixin to prefetch related Categories and Authors to belonging the entry list.
  • BaseTagDetail to provide the behavior of the view.
  • BaseListView to implement the ListView.
get_model_name()

The model name is the tag slugified.

model_type = 'tag'
paginate_by = 10
class zinnia.views.tags.TagList(**kwargs)

Bases: django.views.generic.list.ListView

View return a list of all published tags.

context_object_name = 'tag_list'
get_queryset()

Return a queryset of published tags, with a count of their entries published.

template_name = 'zinnia/tag_list.html'

trackback Module

Views for Zinnia trackback

class zinnia.views.trackback.EntryTrackback(**kwargs)

Bases: zinnia.views.mixins.mimetypes.TemplateMimeTypeView

View for handling trackbacks on the entries

dispatch(*args, **kwargs)

Decorate the view dispatcher with csrf_exempt

get(request, *args, **kwargs)

GET only do a permanent redirection to the Entry

get_object()

Retrieve the Entry trackbacked

mimetype = 'text/xml'
post(request, *args, **kwargs)

Check if an URL is provided and if trackbacks are enabled on the Entry. If so the URL is registered one time as a trackback

template_name = 'zinnia/entry_trackback.xml'