admin Package

admin Package

Admin of Zinnia

category Module

CategoryAdmin for Zinnia

class zinnia.admin.category.CategoryAdmin(model, admin_site)

Bases: django.contrib.admin.options.ModelAdmin

Admin for Category model

fields = ('title', 'parent', 'description', 'slug')

alias of CategoryAdminForm


Return the category’s tree path in HTML

list_display = ('title', 'slug', 'get_tree_path', 'description')
list_filter = ('parent',)
prepopulated_fields = {'slug': ('title',)}
search_fields = ('title', 'description')

entry Module

EntryAdmin for Zinnia

class zinnia.admin.entry.EntryAdmin(model, admin_site)

Bases: django.contrib.admin.options.ModelAdmin

Admin for Entry model

actions = ['make_mine', 'make_published', 'make_hidden', 'close_comments', 'close_pingbacks', 'ping_directories', 'make_tweet', 'put_on_top']
actions_on_bottom = True
actions_on_top = True

View for tag autocompletion

close_comments(request, queryset)

Close the comments for selected entries

close_pingbacks(request, queryset)

Close the pingbacks for selected entries

content_preview(*args, **kwargs)

Admin view to preview Entry.content in HTML, useful when using markups to write entries

date_hierarchy = 'creation_date'
fieldsets = ((<django.utils.functional.__proxy__ object at 0x4645ad0>, {'fields': ('title', 'content', 'image', 'status')}), (<django.utils.functional.__proxy__ object at 0x4510850>, {'fields': ('featured', 'excerpt', 'template', 'related', 'authors', 'creation_date', 'start_publication', 'end_publication'), 'classes': ('collapse', 'collapse-closed')}), (<django.utils.functional.__proxy__ object at 0x4510890>, {'fields': ('password', 'login_required'), 'classes': ('collapse', 'collapse-closed')}), (<django.utils.functional.__proxy__ object at 0x45108d0>, {'fields': ('comment_enabled', 'pingback_enabled')}), (<django.utils.functional.__proxy__ object at 0x4510910>, {'fields': ('categories', 'tags', 'sites', 'slug')}))
filter_horizontal = ('categories', 'authors', 'related')

alias of EntryAdminForm

formfield_for_manytomany(db_field, request, **kwargs)

Filters the disposable authors


Define user actions by permissions


Return the authors in HTML


Return the categories linked in HTML


Admin wrapper for entry.comments_are_open


Admin wrapper for entry.is_actual


Admin wrapper for entry.is_visible

Return a formated link to the entry

get_readonly_fields(request, obj=None)

Return the short url in HTML


Return the sites linked in HTML


Return the tags linked in HTML


Return the title with word count and number of comments

list_display = ('get_title', 'get_authors', 'get_categories', 'get_tags', 'get_sites', 'get_comments_are_open', 'pingback_enabled', 'get_is_actual', 'get_is_visible', 'get_link', 'get_short_url', 'creation_date')
list_filter = ('categories', <class 'zinnia.admin.filters.AuthorListFilter'>, 'status', 'featured', 'login_required', 'comment_enabled', 'pingback_enabled', 'creation_date', 'start_publication', 'end_publication', 'sites')
make_hidden(request, queryset)

Set entries selected as hidden

make_mine(request, queryset)

Set the entries to the user

make_published(request, queryset)

Set entries selected as published

make_tweet(request, queryset)

Post an update on Twitter


View for serving the config of MarkItUp

ping_directories(request, queryset, messages=True)

Ping Directories for selected entries

prepopulated_fields = {'slug': ('title',)}
put_on_top(request, queryset)

Put the selected entries on top at the current date


Make special filtering by user permissions

radio_fields = {'template': 2}
save_model(request, entry, form, change)

Save the authors, update time, make an excerpt

search_fields = ('title', 'excerpt', 'content', 'tags')

View for serving the config of WYMEditor

filters Module

Filters for Zinnia admin

class zinnia.admin.filters.AuthorListFilter(request, params, model, model_admin)

Bases: django.contrib.admin.filters.SimpleListFilter

List filter for EntryAdmin filtering possibilities to published authors only.

lookups(request, model_admin)

Return published authors choices with their entries number

parameter_name = 'author'
queryset(request, queryset)

Return the author’s entries if a value is set

title = <django.utils.functional.__proxy__ object at 0x45d7210>

forms Module

Forms for Zinnia admin

class zinnia.admin.forms.CategoryAdminForm(*args, **kwargs)

Bases: django.forms.models.ModelForm

Form for Category’s Admin

class Meta

CategoryAdminForm’s Meta


alias of Category

CategoryAdminForm.admin_site = <django.contrib.admin.sites.AdminSite object at 0x259d210>
CategoryAdminForm.base_fields = {'title': <django.forms.fields.CharField object at 0x45d7f50>, 'slug': <django.forms.fields.SlugField object at 0x4645090>, 'description': <django.forms.fields.CharField object at 0x4645350>, 'parent': <zinnia.admin.widgets.TreeNodeChoiceField object at 0x45d75d0>}

Check if category parent is not selfish

CategoryAdminForm.declared_fields = {'parent': <zinnia.admin.widgets.TreeNodeChoiceField object at 0x45d75d0>}
class zinnia.admin.forms.EntryAdminForm(*args, **kwargs)

Bases: django.forms.models.ModelForm

Form for Entry’s Admin

class Meta

EntryAdminForm’s Meta


alias of Entry

EntryAdminForm.admin_site = <django.contrib.admin.sites.AdminSite object at 0x259d210>
EntryAdminForm.base_fields = {'title': <django.forms.fields.CharField object at 0x4645890>, 'image': <django.forms.fields.ImageField object at 0x4645cd0>, 'content': <django.forms.fields.CharField object at 0x4645f50>, 'excerpt': <django.forms.fields.CharField object at 0x44e2250>, 'tags': <tagging.forms.TagField object at 0x44e2990>, 'categories': <zinnia.admin.widgets.MPTTModelMultipleChoiceField object at 0x4645550>, 'related': <django.forms.models.ModelMultipleChoiceField object at 0x44f1190>, 'slug': <django.forms.fields.SlugField object at 0x44f1290>, 'authors': <django.forms.models.ModelMultipleChoiceField object at 0x44f1650>, 'status': <django.forms.fields.TypedChoiceField object at 0x44f1750>, 'featured': <django.forms.fields.BooleanField object at 0x44f19d0>, 'comment_enabled': <django.forms.fields.BooleanField object at 0x44f1c90>, 'pingback_enabled': <django.forms.fields.BooleanField object at 0x44f1f50>, 'creation_date': <django.forms.fields.DateTimeField object at 0x44ff290>, 'last_update': <django.forms.fields.DateTimeField object at 0x44ff550>, 'start_publication': <django.forms.fields.DateTimeField object at 0x44ff810>, 'end_publication': <django.forms.fields.DateTimeField object at 0x44ffad0>, 'sites': <django.forms.models.ModelMultipleChoiceField object at 0x44ffe50>, 'login_required': <django.forms.fields.BooleanField object at 0x4510190>, 'password': <django.forms.fields.CharField object at 0x4510450>, 'template': <django.forms.fields.TypedChoiceField object at 0x4510750>}
EntryAdminForm.declared_fields = {'categories': <zinnia.admin.widgets.MPTTModelMultipleChoiceField object at 0x4645550>}

widgets Module

Widgets for Zinnia admin

class zinnia.admin.widgets.MPTTFilteredSelectMultiple(verbose_name, is_stacked, attrs=None, choices=())

Bases: django.contrib.admin.widgets.FilteredSelectMultiple

MPTT version of FilteredSelectMultiple

class Media

MPTTFilteredSelectMultiple’s Media

js = ('/static/admin/js/core.js', '/static/zinnia/js/mptt_m2m_selectbox.js', '/static/admin/js/SelectFilter2.js')
MPTTFilteredSelectMultiple.render_options(choices, selected_choices)

This is copy’n’pasted from django.forms.widgets Select(Widget) change to the for loop and render_option so they will unpack and use our extra tuple of mptt sort fields (if you pass in some default choices for this field, make sure they have the extra tuple too!)

class zinnia.admin.widgets.MPTTModelChoiceIterator(field)

Bases: django.forms.models.ModelChoiceIterator

MPTT version of ModelChoiceIterator


Overriding choice method

class zinnia.admin.widgets.MPTTModelMultipleChoiceField(level_indicator=u'|--', *args, **kwargs)

Bases: django.forms.models.ModelMultipleChoiceField

MPTT version of ModelMultipleChoiceField


Overriding _get_choices


Creates labels which represent the tree level of each node when generating option labels.

class zinnia.admin.widgets.TreeNodeChoiceField(level_indicator=u'|--', *args, **kwargs)

Bases: django.forms.models.ModelChoiceField

Duplicating the TreeNodeChoiceField bundled in django-mptt to avoid conflict with the TreeNodeChoiceField bundled in django-cms...


Creates labels which represent the tree level of each node when generating option labels.

Project Versions

Table Of Contents

Previous topic

Zinnia API

Next topic

spam_checker Package

This Page