Skip to main content

Menu helpers for django projects

Project description

django-menus is an app that provides some useful template helpers for rendering and handling menus within django projects.

To use in in your django project, it needs to be installed:

$ pip install django-menus

And "menus" needs to be in your settings.INSTALLED_APPS.

tree_menu

An extension to django-mptt, this is a template that you can use to have a dynamic tree menu, where selecting items with children expands them, and selecting a leaf node follows the link. To use it, you’ll need to have mptt installed into your project as well as this package.

You use it like:

{% load mptt_tags %}

{% block tree_menu %}
  {% full_tree_for_model app_label.ModelName as menu %}
  {% include "menu/tree-menu.html" %}
{% endblock %}

If you want it to dynamically hide/show nested data, then you will want to have:

<script src="{{ STATIC_URL }}menus/js/tree-menu.js"></script>
<link rel="stylesheet" href="{{ STATIC_URL }}menus/style/tree-menu.css"
      type="text/css" media="screen" title="no title" charset="utf-8">

Somewhere in your page.

This part is currently in use in one small part of a project, and may change if I start to use it more. This README is a little light on because I haven’t touched this code in a long, long time.

Changes

1.0.8 - Allow for absolute urls, ie, pointing to another server. We never try to validate these for permission to view, it is assumed the user can.

1.0.7 - Change how version number is stored. Include a new li-item.html template, and refactor how the template is found. Check func_code exists before accessing it. Refactor some of the handling of paths. Better handle quoting issues.

1.0.6 - Documentation fix only.

1.0.5 - Actually install all of the static media/templates.

1.0.4 - Don’t fail on install if README.md missing.

1.0.3 - Repackaged to include README.rst [Thanks to John Bazik jsb@cs.brown.edu]

Project details


Download files

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

Source Distribution

django-menus-1.0.8.tar.gz (7.1 kB view details)

Uploaded Source

File details

Details for the file django-menus-1.0.8.tar.gz.

File metadata

File hashes

Hashes for django-menus-1.0.8.tar.gz
Algorithm Hash digest
SHA256 32fc1da3de8438bfafc35798513bdefa1b8d5550229409d8a805ebb70f38018e
MD5 97ca2a52ea5041623cd55338b150ad63
BLAKE2b-256 f53a11c06c94d8d3c892c02f84dec4f897770734d80509d629f5bc3200c01385

See more details on using hashes here.

Supported by

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