Skip to main content

Django CMS Named Menus

An extension for Django CMS that allows you to create multiple menus like Wordpress

Replaces Previous Versions

This replaces the previous versions by Ryan Bagwell and Rogerio Carrasqueira which are no longer actively updated

Originally forked from:

Installation

  1. Install with pip pip install djangocms-named-menus

  2. Add cms_named_menus to INSTALLED_APPS

  3. Run migrations python manage.py migrate

Upgrading from Previous Version

  1. Uninstall previous version with pip pip uninstall -y django-cms-named-menus

  2. The migrations and code will pick up previous versions correctly.

Usage

After installation, place the {% show_named_menu 'MenuName' %} template tag where you want your menu to appear.

{% load named_cms_menu_tags %}
<ul>
  {% show_named_menu "Main Menu" %}
</ul>

Next, create your menu in the admin area using the drag and drop interface. Drag items with child menu items:

screenshot

Drag items without child menu items:

screenshot

Settings

The following settings can be changed by adding to your project's settings.py file:

  1. Override the default cache duration for Named Menus, default = 3600 seconds
CMS_NAMED_MENUS_CACHE_DURATION = 3600
  1. Set the application namespaces that can be used with Named Menus as a list, default is CMS pages only - as the page id will not be unique for other applications e.g. Aldryn NewsBlog etc. (default = ['CMSMenu',])
CMS_NAMED_MENUS_NAMESPACES = ['CMSMenu',]

or to allow ALL namespaces:

CMS_NAMED_MENUS_NAMESPACES = None
  1. Automatically remove pages that have been unpublished, deleted, or removed from Navigation (default = True)
CMS_NAMED_MENUS_REMOVE_UNAVAILABLE_PAGES = True

Testing

Install test dependencies

pip install -e ".[test]"

This installs the package in editable mode along with test dependencies:

  • djangocms-text-ckeditor
  • django-sekizai

Run tests

python -m django test tests --settings=tests.settings

For verbose output:

python -m django test tests --settings=tests.settings -v 2

Tests use an in-memory SQLite database and cover:

  • Model creation, __str__, auto-slug generation, and JSONField storage
  • unique_together constraint on (slug, site) and AutoSlugField deduplication
  • Cache utilities (flatten_menu, contains_page, key formatting)
  • Cache operations (set, get, delete, delete_many)
  • Admin helpers (get_all_available_ids, clean_menu, SimpleNode, LazyEncoder)
  • Default settings values (CACHE_DURATION, ALLOWED_NAMESPACES)
  • Signal-based cache invalidation on menu save and delete
  • Admin views (changelist, add form, change form, site-filtered listing)
  • JSONField migration verification (store/retrieve list, empty list, null)

Note: The test_filter_by_json_content test is automatically skipped on SQLite as contains lookups require PostgreSQL or MariaDB 10.2.3+.

Metadata

Release files for djangocms-named-menus 3.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for djangocms-named-menus 3.0.1
File Size Uploaded
djangocms_named_menus-3.0.1.tar.gz 42.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for djangocms-named-menus 3.0.1
File Interpreter ABI Platform
djangocms_named_menus-3.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 90.3 kB

Release files / djangocms_named_menus-3.0.1.tar.gz

Download URL djangocms_named_menus-3.0.1.tar.gz
Size 42.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1fdae21324f89543f0c1fd24c478ec5dab887eb4f0fc5606341e8823a75910b1
BLAKE2b-256 checksum
How to use checksums
d6e3c7efc987d56e792944e3f4f499e30ddb2aeda573c0e1d7039c620b5a42b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / djangocms_named_menus-3.0.1-py3-none-any.whl

Download URL djangocms_named_menus-3.0.1-py3-none-any.whl
Size 48.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fb56dc77810ca989b0dd2967a9f351f60cfa0c510cf92ac97d976e2490c98b5e
BLAKE2b-256 checksum
How to use checksums
b5a3308d56b1e67f7e9e5bb1ad48d8b74a3ec6953c70e7fbc9d4cf1d7c054c3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

3.0.1 This release

2 release files

3.0.0

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page