Admin¶
Django admin integration for stories management.
Admin Classes¶
PostAdmin¶
- class PostAdmin(model, admin_site)[source]¶
Bases:
FrontendEditableAdminMixin,ModelAppHookConfig,GrouperModelAdmin- app_config_initial_fields = ('app_config', 'content__language')¶
- extra_grouping_fields: tuple[str, ...] = ('language',)¶
Indicates additional grouping fields such as
"language"for example. Additional grouping fields create tabs in the change form and a dropdown menu in the change list view.Note
All fields serving as extra grouping fields must be part of the admin’s
fieldsetssetting forGrouperModelAdminto work properly. In the change form the fields will be invisible.
- inlines = []¶
- list_display = ('title', 'author', 'app_config')¶
- list_display_links = ('title',)¶
- search_fields = ('content__title', 'content__subtitle', 'author__last_name', 'author__first_name')¶
- readonly_fields = ('date_created', 'date_modified')¶
- date_hierarchy = 'date_published'¶
- autocomplete_fields = ['author']¶
- frontend_editable_fields = ('title', 'abstract', 'post_text')¶
- enhance_exclude = ('main_image', 'tags')¶
- actions = ['enable_comments', 'disable_comments']¶
- enable_comments(request, queryset)[source]¶
Bulk action to enable comments for selected posts. queryset must not be empty (ensured by django CMS).
- disable_comments(request, queryset)[source]¶
Bulk action to disable comments for selected posts. queryset must not be empty (ensured by django CMS).
- get_list_filter(request)[source]¶
Return a sequence containing the fields to be displayed as filters in the right sidebar of the changelist page.
- has_restricted_sites(request)[source]¶
Whether the current user has permission on one site only
- Parameters:
request – current request
- Returns:
boolean: user has permission on only one site
- get_restricted_sites(request)[source]¶
The sites on which the user has permission on.
To return the permissions, the method check for the
get_sitesmethod on the user instance (e.g.:return request.user.get_sites()) which must return the queryset of enabled sites. If the attribute does not exists, the user is considered enabled for all the websites.- Parameters:
request – current request
- Returns:
boolean or a queryset of available sites
- get_fieldsets(request, obj=None)[source]¶
Customize the fieldsets according to the app settings
- Parameters:
request – request
obj – post
- Returns:
fieldsets configuration
- get_queryset(request)[source]¶
Annotates content fields with the name “content__{field_name}” to the grouper queryset if for all content fields that appear in the
Given the
HttpRequest, the parentModelForminstance, the list of inline formsets and a boolean value based on whether the parent is being added or changed, save the related objects to the database. Note that at this point save_form() and save_model() have already been called.
- property media¶
PostContentAdmin¶
- class PostContentAdmin(model, admin_site)[source]¶
Bases:
FrontendEditableAdminMixin,ModelAdmin- frontend_editable_fields = ['post_text', 'title', 'subtitle']¶
- change_view(request, object_id, form_url='', extra_context=None)[source]¶
Redirect to grouper change view to allow for FrontendEditing of Post Content fields
- property media¶
CategoryAdmin¶
- class CategoryAdmin(model, admin_site)[source]¶
Bases:
FrontendEditableAdminMixin,TranslatableAdmin- form¶
alias of
CategoryAdminForm
- list_display = ['name', 'parent', 'app_config', 'all_languages_column']¶
- fieldsets = ((None, {'fields': ('parent', 'app_config', 'name', 'slug', 'meta_description')}), ('Info', {'classes': ('collapse',), 'fields': ('abstract',)}), ('Image', {'classes': ('collapse',), 'fields': ('main_image', ('main_image_thumbnail', 'main_image_full'))}))¶
- autocomplete_fields = ['parent']¶
- search_fields = ['translationas__name', 'meta_description']¶
- class Media[source]¶
Bases:
object- css = {'all': ('djangocms_stories/css/djangocms_stories_admin.css',)}¶
- property media¶