Reference

API reference automatically generated from source code.

Models

CMS Toolbars

class djangocms_custom_content.cms_toolbars.CustomContentToolbar(*args, **kwargs)

Bases: CMSToolbar

Toolbar for djangocms-custom-content.

Adds a settings icon button to the right toolbar.

Parameters:
  • args (Any)

  • kwargs (Any)

Return type:

Any

classmethod get_insert_position(admin_menu, item_name)

Ensures that there is a SHORTCUTS_BREAK and returns a position for an alphabetical position against all custom content items between SHORTCUTS_BREAK, and the ADMINISTRATION_BREAK.

Args:

admin_menu: The CMS admin menu instance to inspect and modify. item_name: The menu item name used for alphabetical ordering.

Returns:

The integer position where the item should be inserted.

Add shortcut links for each configured grouper model.

add_content_object_menu()

Add menu entries for the current grouper instance.

populate()

Populate the toolbar with custom content entries.

Admin

class djangocms_custom_content.admin.CustomGrouperAdminMixin

Bases: object

Admin mixin to optimize queries and redirect content endpoints.

This mixin prefetches related content for admin lists and provides a breadcrumb redirect compatible with django CMS versioning.

get_queryset(request)

Return a queryset prefetched with latest related content.

Args:

request: The current admin request.

Returns:

The queryset, optionally prefetched with admin manager content.

Parameters:

request (HttpRequest)

get_urls()

Register breadcrumb redirect URLs for grouper admin views.

breadcrumb_redir(request, *args, **kwargs)

Redirect versioning breadcrumb URLs to the grouper admin.

djangocms-versioning uses content admin URLs for breadcrumbs, but this project uses grouper admin classes and must redirect accordingly.

Helpers

djangocms_custom_content.helpers.get_custom_config(model)

Return the custom content configuration tuple for the given model.

Looks up the model in the custom_content_groupers registry and returns a tuple of (content_model, grouper_field_name, enable_versioning). If the model is not registered, returns (None, None, False).