django-lineup


Namedjango-lineup JSON
Version 0.3.3 PyPI version JSON
download
home_pagehttps://github.com/otto-torino/django-lineup
SummaryNavigation system for django sites
upload_time2024-06-18 13:44:52
maintainerNone
docs_urlNone
authorabidibo
requires_pythonNone
licenseMIT
keywords django-lineup
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage
            =============================
Django Lineup
=============================

.. image:: https://badge.fury.io/py/django-lineup.svg
    :target: https://badge.fury.io/py/django-lineup

.. image:: https://travis-ci.org/otto-torino/django-lineup.svg?branch=master
    :target: https://travis-ci.com/github/otto-torino/django-lineup

.. image:: https://codecov.io/gh/otto-torino/django-lineup/branch/master/graph/badge.svg
    :target: https://codecov.io/gh/otto-torino/django-lineup

.. image:: https://static.pepy.tech/badge/django-lineup
    :target: https://pepy.tech/project/django-lineup

Multiple navigation system for django sites.

Django Lineup lets you manage a tree of items. Each first level node represents a menu you can include in your templates.

.. image:: images/lineup.png

Documentation
-------------

The full documentation is at https://django-lineup.readthedocs.io.

Quickstart
----------

Install Django Lineup::

    pip install django-lineup

Add it to your `INSTALLED_APPS`:

.. code-block:: python

    INSTALLED_APPS = (
        ...
        'lineup.apps.LineupConfig',
        ...
    )

Add to your main `urls.py`:

.. code-block:: python

    ...
    path("lineup/", include("lineup.urls", namespace="lineup")),
    ...

Make sure the ``requests`` context processor is included (it is by default):

.. code-block:: python

    TEMPLATES = [
      {
        'OPTIONS': {
          'context_processors': [
            "django.template.context_processors.request",
          ],
        },
      },
    ]

Render a menu:::

    {% load lineup_tags %}
    {% lineup_menu 'my-root-item-slug '%}

Render the breadcrumbs:::

    {% load lineup_tags %}
    {% lineup_breadcrumbs 'my-root-item-slug '%}

Import a menu from a json:::

    $ python manage.py import_menu_from_json

Json example:::

    {
      "label": "Main Menu",
      "slug": "main-menu",
      "order": 0,
      "children": [
        {
          "label": "Tools",
          "slug": "tools",
          "order": 0,
          "children": [
            {
              "label": "DNS Tools",
              "slug": "dns-tools",
              "order": 0,
              "login_required": true,
              "children": [
                {
                  "label": "DMARC DNS Tools",
                  "slug": "dmarc-dns-tools",
                  "link": "/dmarc-tools/",
                  "title": "DMARC Rulez",
                  "order": 0
                }
              ]
            },
            {
              "label": "Password Generator",
              "slug": "password-generator",
              "order": 1
            }
          ]
        },
        {
          "label": "Disabled Item",
          "slug": "disabled-item",
          "order": 1,
          "enabled": false,
          "children": [
            {
              "label": "Disabled child",
              "slug": "disabled-child",
              "order": 0
            }
          ]
        },
        {
          "label": "Perm Item",
          "slug": "perm-item",
          "order": 2,
          "permissions": [
            "add_permission",
            "view_session"
          ]
        }
      ]
    }

Features
--------

- Multiple menus supported
- Visibility logic: login required / permissions
- Render menu tree templatetags
- Breadcrumbs templetetag
- Import a menu from json management command
- Rebuild tree button in admin
- `Django Baton <https://github.com/otto-torino/django-baton>`_ integration to highlight different menu in the admin

Running Tests
-------------

Does the code actually work?

::

    source <YOURVIRTUALENV>/bin/activate
    (myenv) $ pip install -r requirements_test.txt
    (myenv) $ python runtests.py


Development commands
---------------------

::

    pip install -r requirements_dev.txt
    invoke -l


Example app
---------------------

This example is provided as a convenience feature to allow potential users to try the app straight from the app repo without having to create a django project.

It can also be used to develop the app in place.

To run this example, follow these instructions:

1. Navigate to the root directory of your application (same as `manage.py`)
2. Install the requirements for the package:

		pip install -r requirements_test.txt

3. Make and apply migrations

		python manage.py makemigrations

		python manage.py migrate

4. Run the server

		python manage.py runserver

5. Access from the browser at `http://127.0.0.1:8000`
6. Admin user account is admin:admin


Credits
-------
Django Lineup is developed by Otto SRL.

Tools used in rendering this package:

*  Cookiecutter_
*  `cookiecutter-djangopackage`_

.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage




History
-------

0.3.3 (2024-06-18)
++++++++++++++++++

* Improve overall performance
* Add cache

0.3.2 (2024-05-30)
++++++++++++++++++

* Adds rebuild command in admin

0.3.1 (2022-12-22)
++++++++++++++++++

* Adds Dajngo 4 support

0.3.0 (2021-04-27)
++++++++++++++++++

* Adds the extras field

0.2.3 (2021-02-28)
++++++++++++++++++

* Fixes tests

0.2.2 (2021-02-28)
++++++++++++++++++

* Fixes baton row attributes method

0.2.1 (2020-12-14)
++++++++++++++++++

* Adds order field as editable in change list page

* First stable release

0.2.0 (2020-12-14)
++++++++++++++++++

* First stable release

0.1.0 (2020-12-11)
++++++++++++++++++

* First release on PyPI.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/otto-torino/django-lineup",
    "name": "django-lineup",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "django-lineup",
    "author": "abidibo",
    "author_email": "abidibo@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/32/5b/962fe1395929a343b03761eb8db852d0adbe890e088dc31bc746c7d7213a/django-lineup-0.3.3.tar.gz",
    "platform": null,
    "description": "=============================\nDjango Lineup\n=============================\n\n.. image:: https://badge.fury.io/py/django-lineup.svg\n    :target: https://badge.fury.io/py/django-lineup\n\n.. image:: https://travis-ci.org/otto-torino/django-lineup.svg?branch=master\n    :target: https://travis-ci.com/github/otto-torino/django-lineup\n\n.. image:: https://codecov.io/gh/otto-torino/django-lineup/branch/master/graph/badge.svg\n    :target: https://codecov.io/gh/otto-torino/django-lineup\n\n.. image:: https://static.pepy.tech/badge/django-lineup\n    :target: https://pepy.tech/project/django-lineup\n\nMultiple navigation system for django sites.\n\nDjango Lineup lets you manage a tree of items. Each first level node represents a menu you can include in your templates.\n\n.. image:: images/lineup.png\n\nDocumentation\n-------------\n\nThe full documentation is at https://django-lineup.readthedocs.io.\n\nQuickstart\n----------\n\nInstall Django Lineup::\n\n    pip install django-lineup\n\nAdd it to your `INSTALLED_APPS`:\n\n.. code-block:: python\n\n    INSTALLED_APPS = (\n        ...\n        'lineup.apps.LineupConfig',\n        ...\n    )\n\nAdd to your main `urls.py`:\n\n.. code-block:: python\n\n    ...\n    path(\"lineup/\", include(\"lineup.urls\", namespace=\"lineup\")),\n    ...\n\nMake sure the ``requests`` context processor is included (it is by default):\n\n.. code-block:: python\n\n    TEMPLATES = [\n      {\n        'OPTIONS': {\n          'context_processors': [\n            \"django.template.context_processors.request\",\n          ],\n        },\n      },\n    ]\n\nRender a menu:::\n\n    {% load lineup_tags %}\n    {% lineup_menu 'my-root-item-slug '%}\n\nRender the breadcrumbs:::\n\n    {% load lineup_tags %}\n    {% lineup_breadcrumbs 'my-root-item-slug '%}\n\nImport a menu from a json:::\n\n    $ python manage.py import_menu_from_json\n\nJson example:::\n\n    {\n      \"label\": \"Main Menu\",\n      \"slug\": \"main-menu\",\n      \"order\": 0,\n      \"children\": [\n        {\n          \"label\": \"Tools\",\n          \"slug\": \"tools\",\n          \"order\": 0,\n          \"children\": [\n            {\n              \"label\": \"DNS Tools\",\n              \"slug\": \"dns-tools\",\n              \"order\": 0,\n              \"login_required\": true,\n              \"children\": [\n                {\n                  \"label\": \"DMARC DNS Tools\",\n                  \"slug\": \"dmarc-dns-tools\",\n                  \"link\": \"/dmarc-tools/\",\n                  \"title\": \"DMARC Rulez\",\n                  \"order\": 0\n                }\n              ]\n            },\n            {\n              \"label\": \"Password Generator\",\n              \"slug\": \"password-generator\",\n              \"order\": 1\n            }\n          ]\n        },\n        {\n          \"label\": \"Disabled Item\",\n          \"slug\": \"disabled-item\",\n          \"order\": 1,\n          \"enabled\": false,\n          \"children\": [\n            {\n              \"label\": \"Disabled child\",\n              \"slug\": \"disabled-child\",\n              \"order\": 0\n            }\n          ]\n        },\n        {\n          \"label\": \"Perm Item\",\n          \"slug\": \"perm-item\",\n          \"order\": 2,\n          \"permissions\": [\n            \"add_permission\",\n            \"view_session\"\n          ]\n        }\n      ]\n    }\n\nFeatures\n--------\n\n- Multiple menus supported\n- Visibility logic: login required / permissions\n- Render menu tree templatetags\n- Breadcrumbs templetetag\n- Import a menu from json management command\n- Rebuild tree button in admin\n- `Django Baton <https://github.com/otto-torino/django-baton>`_ integration to highlight different menu in the admin\n\nRunning Tests\n-------------\n\nDoes the code actually work?\n\n::\n\n    source <YOURVIRTUALENV>/bin/activate\n    (myenv) $ pip install -r requirements_test.txt\n    (myenv) $ python runtests.py\n\n\nDevelopment commands\n---------------------\n\n::\n\n    pip install -r requirements_dev.txt\n    invoke -l\n\n\nExample app\n---------------------\n\nThis example is provided as a convenience feature to allow potential users to try the app straight from the app repo without having to create a django project.\n\nIt can also be used to develop the app in place.\n\nTo run this example, follow these instructions:\n\n1. Navigate to the root directory of your application (same as `manage.py`)\n2. Install the requirements for the package:\n\n\t\tpip install -r requirements_test.txt\n\n3. Make and apply migrations\n\n\t\tpython manage.py makemigrations\n\n\t\tpython manage.py migrate\n\n4. Run the server\n\n\t\tpython manage.py runserver\n\n5. Access from the browser at `http://127.0.0.1:8000`\n6. Admin user account is admin:admin\n\n\nCredits\n-------\nDjango Lineup is developed by Otto SRL.\n\nTools used in rendering this package:\n\n*  Cookiecutter_\n*  `cookiecutter-djangopackage`_\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage\n\n\n\n\nHistory\n-------\n\n0.3.3 (2024-06-18)\n++++++++++++++++++\n\n* Improve overall performance\n* Add cache\n\n0.3.2 (2024-05-30)\n++++++++++++++++++\n\n* Adds rebuild command in admin\n\n0.3.1 (2022-12-22)\n++++++++++++++++++\n\n* Adds Dajngo 4 support\n\n0.3.0 (2021-04-27)\n++++++++++++++++++\n\n* Adds the extras field\n\n0.2.3 (2021-02-28)\n++++++++++++++++++\n\n* Fixes tests\n\n0.2.2 (2021-02-28)\n++++++++++++++++++\n\n* Fixes baton row attributes method\n\n0.2.1 (2020-12-14)\n++++++++++++++++++\n\n* Adds order field as editable in change list page\n\n* First stable release\n\n0.2.0 (2020-12-14)\n++++++++++++++++++\n\n* First stable release\n\n0.1.0 (2020-12-11)\n++++++++++++++++++\n\n* First release on PyPI.\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Navigation system for django sites",
    "version": "0.3.3",
    "project_urls": {
        "Documentation": "https://django-lineup.readthedocs.io/en/latest/",
        "Homepage": "https://github.com/otto-torino/django-lineup",
        "Source": "https://github.com/otto-torino/django-lineup",
        "Tracker": "https://github.com/otto-torino/django-lineup/issues"
    },
    "split_keywords": [
        "django-lineup"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a1ef2f72f7fcdf55e2805bf249a69d04af55fb4e0cbe9e812ec13a896502465f",
                "md5": "4cbf2c422c5766af117d0df3a80b17cd",
                "sha256": "53465f0efc455609810e06064965ddf590a6aac94ba59e23a9e5d9dbc5338e4f"
            },
            "downloads": -1,
            "filename": "django_lineup-0.3.3-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4cbf2c422c5766af117d0df3a80b17cd",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 16315,
            "upload_time": "2024-06-18T13:44:50",
            "upload_time_iso_8601": "2024-06-18T13:44:50.411126Z",
            "url": "https://files.pythonhosted.org/packages/a1/ef/2f72f7fcdf55e2805bf249a69d04af55fb4e0cbe9e812ec13a896502465f/django_lineup-0.3.3-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "325b962fe1395929a343b03761eb8db852d0adbe890e088dc31bc746c7d7213a",
                "md5": "295ad2e182ede4113172ac03ae3eb976",
                "sha256": "2a1dd8f71304d67706dd53ab921469aad2481cfb7272d2e4326c515366920c5e"
            },
            "downloads": -1,
            "filename": "django-lineup-0.3.3.tar.gz",
            "has_sig": false,
            "md5_digest": "295ad2e182ede4113172ac03ae3eb976",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 14254,
            "upload_time": "2024-06-18T13:44:52",
            "upload_time_iso_8601": "2024-06-18T13:44:52.350614Z",
            "url": "https://files.pythonhosted.org/packages/32/5b/962fe1395929a343b03761eb8db852d0adbe890e088dc31bc746c7d7213a/django-lineup-0.3.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-18 13:44:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "otto-torino",
    "github_project": "django-lineup",
    "travis_ci": true,
    "coveralls": true,
    "github_actions": false,
    "tox": true,
    "lcname": "django-lineup"
}
        
Elapsed time: 0.66031s