-
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
58 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,83 @@ | ||
Simple Django Menus | ||
=================== | ||
=================================== | ||
django-simple-menu |latest-version| | ||
=================================== | ||
|
||
.. image:: https://github.com/jazzband/django-simple-menu/workflows/Test/badge.svg | ||
|jazzband| |build-status| |coverage| |docs| |python-support| |django-support| | ||
|
||
.. |latest-version| image:: https://img.shields.io/pypi/v/django-simple-menu.svg | ||
:target: https://pypi.python.org/pypi/django-simple-menu | ||
:alt: Latest version on PyPI | ||
|
||
.. |jazzband| image:: https://jazzband.co/static/img/badge.svg | ||
:target: https://jazzband.co/ | ||
:alt: Jazzband | ||
|
||
.. |build-status| image:: https://github.com/jazzband/django-simple-menu/actions/workflows/test.yml/badge.svg | ||
:target: https://github.com/jazzband/django-simple-menu/actions | ||
:alt: GitHub Actions | ||
:alt: Build Status | ||
|
||
.. |coverage| image:: https://img.shields.io/codecov/c/github/jazzband/django-simple-menu.svg | ||
:target: https://codecov.io/github/jazzband/django-simple-menu | ||
:alt: Test coverage status | ||
|
||
.. image:: https://img.shields.io/codecov/c/github/jazzband/django-simple-menu.svg | ||
:target: https://codecov.io/github/jazzband/django-simple-menu | ||
.. |docs| image:: https://img.shields.io/readthedocs/django-simple-menu/latest.svg | ||
:target: https://django-simple-menu.readthedocs.io/ | ||
:alt: Documentation status | ||
|
||
.. image:: https://img.shields.io/pypi/v/django-simple-menu.svg | ||
:target: https://pypi.python.org/pypi/django-simple-menu | ||
:alt: Latest PyPI version | ||
.. |python-support| image:: https://img.shields.io/pypi/pyversions/django-simple-menu | ||
:target: https://pypi.python.org/pypi/django-simple-menu | ||
:alt: Supported Python versions | ||
|
||
.. image:: https://jazzband.co/static/img/badge.svg | ||
:target: https://jazzband.co/ | ||
:alt: Jazzband | ||
.. |django-support| image:: https://img.shields.io/pypi/djversions/django-simple-menu | ||
:target: https://pypi.org/project/django-simple-menu | ||
:alt: Supported Django versions | ||
|
||
django-simple-menu is an entirely code based menu system, because, who really wants to define their | ||
menus in the django admin... | ||
``django-simple-menu`` is an entirely code based menu system, because, who | ||
really wants to define their menus inside Django Admin?.. | ||
|
||
It's simple to use, yet provides enough flexibility to provide unlimited children menus, per-request | ||
generation and checking of menu items, badges, and more. | ||
It's simple to use, yet provides enough flexibility to provide unlimited | ||
children menus, per-request generation and checking of menu items, badges, | ||
and more. | ||
|
||
|
||
Quickstart | ||
---------- | ||
|
||
Using django-simple-menu is easy. | ||
**Requirements:** Python 3.6+, Django 2.2+ | ||
|
||
Install ``django-simple-menu`` in your virtualenv and then add ``menu`` to your ``INSTALLED_APPS``. | ||
Please ensure that you have ``django.core.context_processors.request`` listed in the | ||
``TEMPLATE_CONTEXT_PROCESSORS`` setting. | ||
1. Install the ``django-simple-menu`` package. | ||
|
||
For each of your own apps that you want to expose a menu create a new file named ``menus.py`` and | ||
define your menus using the ``Menu`` and ``MenuItem`` classes you can import from the ``menu`` | ||
namespace. | ||
2. Add ``menu`` to your ``INSTALLED_APPS``. | ||
|
||
In a template you want to render a menu first ``{% load menu %}`` then call ``{% generate_menu %}`` | ||
inside a block and a new varaible named ``menus`` will be added to the context. You can now iterate | ||
over this ``menus`` object to render your menus. | ||
- please ensure that you have ``django.template.context_processors.request`` | ||
listed under ``TEMPLATES[...]["OPTIONS"]["context_processors"]``. | ||
|
||
To quickly see everything in action and evaluate django-simple-menut please check out the | ||
3. Create ``menus.py`` inside each app you want to create a menu for and define | ||
said menus using the ``Menu`` and ``MenuItem`` classes you can import from | ||
the ``menu`` namespace. | ||
|
||
4. In your templates, load the template tags (``{% load menu %}``) and call | ||
``{% generate_menu %}`` inside a block. Your context will be populated with | ||
a new object named ``menus``. You can now iterate over it to render your | ||
menus. | ||
|
||
To quickly see ``django-simple-menu`` in action, check out the | ||
`example project`_. | ||
|
||
.. _example project: https://github.com/jazzband/django-simple-menu/tree/master/example | ||
|
||
|
||
Documentation | ||
------------- | ||
|
||
The full documentation is located in the docs directory and can be viewed at: | ||
More | ||
---- | ||
|
||
https://django-simple-menu.readthedocs.org | ||
Full documentation, including installation and configuration instructions, is | ||
available at https://django-simple-menu.readthedocs.io/. | ||
|
||
``django-simple-menu`` is released under the *BSD 2-Clause "Simplified" License*. | ||
If you like it, please consider contributing! | ||
|
||
Requirements | ||
------------ | ||
``django-simple-menu`` was originally created by | ||
Evan Borgstom <[email protected]> and was further developed by many | ||
contributors_. | ||
|
||
Django 2.2+ | ||
Python 3.6+ | ||
.. _contributors: https://github.com/jazzband/django-simple-menu/graphs/contributors |