Skip to main content

An alias is a collection of plugins that is managed centrally.

Project description

Latest PyPI version Coverage Django versions django CMS versions

django CMS Alias replicates and extends the alias function of django CMS version 3 for django CMS version 4 and later.

An alias is a collection of plugins that is managed centrally. A reference can be added to any placeholder using the Alias plugin. Since the Alias plugin creates a reference any changes to the alias are immediately reflected at all places it is used.

Aliases are created and edited independently of their usage through their own dedicated editing endpoints, i.e. outside of django CMS pages. This allows content managers to maintain alias content without needing to navigate to a page where the alias is used.

When editing a page that contains static aliases, these aliases are shown in the structure board, providing visibility into the alias’ content while maintaining the separation between alias management and page editing. If the static alias can be changed, it is fully accessible through the structure board.

Static aliases cannot be changed in the structure board on views that have no editing interface.

django CMS Alias supports versioning aliases by django CMS Versioning.

Installation

Requirements

django CMS Alias requires that you have a django CMS 4 (or higher) project already running and set up.

To install

Run:

pip install djangocms-alias

Add djangocms_alias and parler to your project’s INSTALLED_APPS.

Run:

python manage.py migrate djangocms_alias

to perform the application’s database migrations.

Configuration

django CMS Alias provides several Django settings to control its behavior:

STATIC_ALIAS_EDITING_ENABLED

Default: True

Controls whether static aliases can be edited directly on frontend editable objects (such as pages) that include the {% static_alias %} template tag. When set to False, static aliases will not be visible in the structure board and only editable from the alias admin endpoint.

VERSIONING_ALIAS_MODELS_ENABLED

Default: True (if djangocms-versioning is installed)

Enables versioning support for alias models when djangocms-versioning is available. When enabled, aliases support draft/published workflows, version history, and proper content lifecycle management. Set to False to disable versioning for aliases even if djangocms-versioning is installed. Any changes to any alias will then be immediately visible to the world.

MODERATING_ALIAS_MODELS_ENABLED

Default: True (if djangocms-moderation is installed)

Enables moderation workflows for alias models when djangocms-moderation is available. When enabled, aliases can be subject to approval workflows before publication. Set to False to disable moderation for aliases even if djangocms-moderation is installed.

Usage

Static aliases

Static aliases appear in templates and replace static placeholders which were part of django CMS up to version 3.x.

Example:

{% load djangocms_alias_tags %}
...
<footer>
  {% static_alias 'footer' %}
</footer>

New in version 3: Static aliases can now be edited directly on any frontend editable object (such as pages) that includes the {% static_alias %} template tag. Static aliases are marked by a pin icon in the structure board to distinguish them from regular content.

Editing static aliases on the page provides a convenient way to manage alias content in context. However, when using djangocms-versioning, there are important considerations:

Versioning Considerations:

  • Independent Publishing: Static aliases must be published independently from their edit endpoint. Use the edit entry in the alias’s burger menu in the structure board to access the full alias editing interface.

  • Published Content Only: When objects are viewed on the site (not in edit mode), only the latest published alias version is displayed. If no published version exists, nothing will be shown.

  • Draft Creation Required: Published aliases cannot be edited - neither in the structure menu nor on their dedicated endpoint. You must create a new draft version of the alias before editing is possible.

This workflow ensures content consistency and proper version control while providing the flexibility to edit aliases in context when appropriate.

Alias plugin

Alternatively, aliases can be used with the Alias plugin. It allows to select which alias content is shown at the exact position the alias plugin is placed.

Templates

For the plugin to work out of the box {% block content %} is expected to exist in your main base.html file. Here is the template hierarchy for the edit and preview endpoints:

base.html
    └── djangocms_alias/base.html {% block content %}
          └── djangocms_alias/alias_content_preview.html  {% block alias_content %}

Use Django’s template override mechanism to customize these templates as needed. Say, if your base template has a different name and the content goes into a block called main_content, you would create a template at templates/djangocms_alias/base.html with the following content:

{% extends "mybase.html" %}
{% load i18n %}

{% block title %}{% translate "Aliases" %}{% endblock %}
{% block main_content %}
    <div class="aliases my-additional-class">
        {% block aliases_content %}
        {% endblock aliases_content %}
    </div>
{% endblock main_content %}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

djangocms_alias-3.0.3.tar.gz (68.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

djangocms_alias-3.0.3-py3-none-any.whl (65.8 kB view details)

Uploaded Python 3

File details

Details for the file djangocms_alias-3.0.3.tar.gz.

File metadata

  • Download URL: djangocms_alias-3.0.3.tar.gz
  • Upload date:
  • Size: 68.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for djangocms_alias-3.0.3.tar.gz
Algorithm Hash digest
SHA256 b3de5080ef60bbd9ff119ccb5b33b22401d157ebd18acde9c54a6ec6839f1a1d
MD5 baadcf69058e79fe511b2bf54a157564
BLAKE2b-256 1054da1661897370cbf6b995283ee6cea81ad50b29ba7a4bd196f7eb622ba977

See more details on using hashes here.

Provenance

The following attestation bundles were made for djangocms_alias-3.0.3.tar.gz:

Publisher: publish-to-live-pypi.yml on django-cms/djangocms-alias

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file djangocms_alias-3.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for djangocms_alias-3.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0cfac9b137a494563baaa1c4358a1e1042c422ad83f4b6eec7c89929646161ef
MD5 e6bc482b0a8f0e94b0a2a05d041336f9
BLAKE2b-256 02be843626b5e0aa04d013942ebbdfce3cdf999fb30a7a3efa895e3cf747daa6

See more details on using hashes here.

Provenance

The following attestation bundles were made for djangocms_alias-3.0.3-py3-none-any.whl:

Publisher: publish-to-live-pypi.yml on django-cms/djangocms-alias

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page