Because no-one can easily visualise what parameters will do to a django CMS site using {% show_menu %}
Add 'menupreview'
to your INSTALLED_APPS
, and visit the Django administration.
It's a complete hack. Here, let's count the ways:
- It uses a standard Model object, which has no attributes, and declares itself as unmanaged by the ORM.
- The model declares its
app_label
as cms. Yes, really. Because I wanted it grouped with the rest of the CMS functionality. - It has an empty migration for South, just for safety's sake.
- It uses a standard python class (rather than a ModelAdmin instance) to register itself to the Django administration, and simply provides enough attribute defaults to trick the admin validation.
- The admin class overrides permissions management to only display the hackyness to super users, which is a small mercy.
- It overrides the usual URLs, and provides its own changelist, which is really anything but.
- The changelist, awesomely, modifies the request object by changing the
path
attribute, to trick{% show_menu %}
into thinking the right node is selected. I am genuinely surprised that the object isn't immutable. - It depends on the new, easy way to get data from a form instance in Django 1.3, where
form.field.value
can return initial or bound data. I could probably fix this to support 1.2, though. - It uses AJAX, but doesn't do so in a particularly nice way, subsequently, form validation messages are pretty much out the window. Though it does re-use the provided version of jQuery, and cleans up after itself by being anonymous.
On the up side of all of that, it should be a fair emulation of the menu you'd otherwise be experimenting with in templates, including any registered Menu
or AttachMenu
instances. And it should technically work without AJAX, which is always a bonus.
- Django 1.3+
- django CMS 2.2+
- It might work on 2.1.3, but I've not yet tried.
Presumably, if you're reading this bit, you have a problem with it. Or you just want there to be less numbers in the implementation section. Check my GitHub, which is probably where this project is.
At the moment, there isn't any.