Skip to main content

Alacarte

django-alacarte is a minimalist menu app for Django.

Installation

$ pip install django-alacarte

Usage

Add “alacarte” to your INSTALLED_APPS:

INSTALLED_APPS = (
    ...,
    'alacarte',
)

In your root urls.py add the following code:

# ...

import alacarte
alacarte.autodiscover()

# Your url patterns

Note: You don’t need this if you use Django >= 1.7, autodiscovery is made automatically with AppConfig.

Create a file called menu.py inside the app of your choice and register its corresponding menus:

import alacarte


class BankTransactionsMenu(alacarte.Menu):
    label = 'Transactions'
    url_name = 'bank_transactions'


class BankBalanceMenu(alacarte.Menu):
    label = 'Balance'
    url_name = 'bank_balance'


class BankPremiumMenu(alacarte.Menu):
    label = 'Premium Offers'
    url_name = 'bank_premium_offers'

    def shown(self)
        user = self.context['user']
        return user.is_premium()


class BankMenu(alacarte.Menu):
    group = 'main'
    label = 'Bank'
    submenus = (
        BankTransactionsMenu(),
        BankBalanceMenu(),
        BankPremiumMenu(),
    )

    def shown(self):
        user = self.context['user']
        return user.is_authenticated()


alacarte.register(BankMenu)

Then in your template:

{% load alacarte %}
{# ... #}
    {# ... #}
    {% alacarte "main" %}
    {# ... #}
{# ... #}

Support

  • Django >= 1.3

  • Tested on Python 2.7 and 3.4


django-alacarte is not related to https://pypi.python.org/pypi/alacarte

Metadata

Release files for django-alacarte 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-alacarte 0.1.6
File Size Uploaded Provenance Actions
django-alacarte-0.1.6.tar.gz 4.8 kB Without provenance Details for django-alacarte-0.1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-alacarte 0.1.6
File Interpreter ABI Platform Actions
django_alacarte-0.1.6-py2.py3-none-any.whl Python 3, Python 2 none any Details for django_alacarte-0.1.6-py2.py3-none-any.whl

Total release size: 12.0 kB

Release files / django-alacarte-0.1.6.tar.gz

Download URL django-alacarte-0.1.6.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4b0eb2bb7cc54c2df92437e05026edceff412aa0452949d2530b350cfde55552
BLAKE2b-256 checksum
How to use checksums
0ad57c48546002a527261061661f9398a183923be651b6e2010db112d2421085
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_alacarte-0.1.6-py2.py3-none-any.whl

Download URL django_alacarte-0.1.6-py2.py3-none-any.whl
Size 7.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
32e86e4da288049d5c93b9b5f428bab954ef34660d7bb01cff6e65aba290274f
BLAKE2b-256 checksum
How to use checksums
3ad53dc57f62e644e2b8f5e49801f83d9225720f3a6c627813ccd2fd929216ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-alacarte 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page