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.
queryset()
class zinnia.views.archives.EntryDay(**kwargs)

Bases: 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.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.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.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: django.views.generic.base.TemplateView

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/

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

Bases: zinnia.views.capabilities.CapabilityView

http://www.opensearch.org/

content_type = '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

content_type = '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

content_type = '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.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
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=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.util.ErrorList'>, label_suffix=u':', 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>, 'slug': <django.forms.fields.SlugField object>, 'status': <django.forms.fields.TypedChoiceField object>, 'start_publication': <django.forms.fields.DateTimeField object>, 'end_publication': <django.forms.fields.DateTimeField object>, 'sites': <django.forms.models.ModelMultipleChoiceField object>, 'creation_date': <django.forms.fields.DateTimeField object>, 'last_update': <django.forms.fields.DateTimeField object>, 'content': <django.forms.fields.CharField object>, 'comment_enabled': <django.forms.fields.BooleanField object>, 'pingback_enabled': <django.forms.fields.BooleanField object>, 'trackback_enabled': <django.forms.fields.BooleanField object>, 'related': <django.forms.models.ModelMultipleChoiceField object>, 'excerpt': <django.forms.fields.CharField object>, 'image': <django.forms.fields.ImageField object>, 'featured': <django.forms.fields.BooleanField object>, 'authors': <django.forms.models.ModelMultipleChoiceField object>, 'categories': <django.forms.models.ModelMultipleChoiceField object>, 'tags': <tagging.forms.TagField object>, 'login_required': <django.forms.fields.BooleanField object>, 'password': <django.forms.fields.CharField object>, 'content_template': <django.forms.fields.TypedChoiceField object>, 'detail_template': <django.forms.fields.TypedChoiceField object>}
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: django.views.generic.base.TemplateView

View for handling trackbacks on the entries

content_type = u'text/xml'
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

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 = u'zinnia/entry_trackback.xml'