Skip to content
Menu app for Django with ordering and ability to link menu item with model instance, view or URL.
Branch: master
Clone or download
Pull request Compare This branch is 1 commit ahead of althalus:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



A dead simple menu app for Django with ordering in admin interface and ability to link menu item with model instance, view or URL.

It features user-proof admin interface with links for ordering items and limited list of available pages to link to. You should register your views, QuerySets, model instances or URLs to populate that list.


  1. Run python install or just place simplemenu directory into a directory which is on your PYTHONPATH.
  2. Add 'simplemenu' to your INSTALLED_APPS setting.
  3. Run python syncdb.
  4. Register your pages by adding calls to simplemenu.register.
  5. Add menu to your templates.

Note that this application requires Django 1.1 or newer.

Registering your pages

The idea was to make editing menu via admin interface as simple as possible. So in order to create new menu item user only have to enter its name and choose a page from a drop-down list. You have to register a page to make it available for user.

For example, you could add this code to your

import simplemenu


In that case list of pages will be consist of "Recent entries" and names of all existing FlatPages.

You can register the following objects:

  • views (basically anything reversible w/o parameters):

    ('app.views.viewname', u'Custom name for the admin interface'),
  • QuerySets or model instances (QuerySets will be evaluated every time the menu item form is created. Menu item stores only ContentType and PK of the object. Every object must have get_absolute_url method.):

  • URLs:

    ('/another/url', u'Name of the page'),


This app has only one tag:

{% get_simplemenu as [varname] %}

It stores QuerySet of all menu items in a context variable. Example:

{% load simplemenu_tags %}
{% get_simplemenu as menu %}
{% for item in menu %}
    <a href="{{ }}">{{ }}</a>
{% endfor %}

Highlight visited menu items

It's relatively simple to handle menu item that links to current page. First, you need to have URL of the page in your template context. The most common way to do it is to add 'django.core.context_processors.request' to the TEMPLATE_CONTEXT_PROCESSORS setting and to use RequestContext in your views. Then you could write in your template the following:

{% load simplemenu_tags %}
{% get_simplemenu as menu %}
{% for item in menu %}
    <li {% ifequal request.path %}class="selected"{% endifequal %}>
        <a href="{{ }}">{{ }}</a></li>
{% endfor %}
You can’t perform that action at this time.