Git Product home page Git Product logo

django-grappelli-extensions's Introduction

django-grappelli-extensions

Test Status

Code Health

Latest PyPI version

Number of PyPI downloads

Available features:

Installation

  • pip install django-grappelli-extensions
  • Put grappelli_extensions before grappelli on INSTALLED_APPS.

settings.py

  • Put 'grappelli_extensions' before 'grappelli' on INSTALLED_APPS
  • Put 'apptemplates.Loader' on your TEMPLATE_LOADERS setting:
# Your setting will look like:
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
    'apptemplates.Loader',
)

Navigation bar

Set the class that will generate your navigation bar:

GRAPPELLI_EXTENSIONS_NAVBAR = 'extensions.Navbar'

or if you have multiple admin sites

GRAPPELLI_EXTENSIONS_NAVBAR = {  # alternative method
    'yourproject.admin.admin_site': 'yourproject.extensions.Navbar',
    'yourproject.admin.second_admin_site': 'yourproject.extensions.second_Navbar',
}

sidebar

Navigation bar

Set the class that will generate your sidebar:

GRAPPELLI_EXTENSIONS_SIDEBAR = 'extensions.Sidebar'

or if you have multiple admin sites

GRAPPELLI_EXTENSIONS_SIDEBAR = {  # alternative method
    'yourproject.admin.admin_site': 'yourproject.extensions.Sidebar',
    'yourproject.admin.second_admin_site': 'yourproject.extensions.second_Sidebar',
}

extensions.py

from django.core.urlresolvers import reverse_lazy

from grappelli_extensions.nodes import CLNode


class Navbar(object):
    nodes = (
        ('Auth', {'nodes': (
            ('Users', {
                'url': reverse_lazy('admin:auth_user_changelist'),
                'perm': 'auth.change_user',
            }),
            ('Groups', {
                'url': reverse_lazy('admin:auth_group_changelist'),
                'perm': 'auth.change_group',
            }),
        )}),
        ('Sites',
            {'url': reverse_lazy('admin:sites_site_changelist')}),
        ('Nodes', {'nodes': (
            CLNode('auth', 'user'),
            CLNode('sites', 'site'),
        )}),
        CLNode('auth', 'user', u"Site users"),
    )

IMPORTANT: Sidebar class follows the very same structure (But only use root nodes).

To run tests

pip install -r requirements/tests.txt Django
export DJANGO_SETTINGS_MODULE=grappelli_extensions.test_settings
`which django-admin.py` test grappelli_extensions"

Contributing

  1. Fork it.
  2. Create your feature branch. (git checkout -b my-new-feature)
  3. Commit your changes. (git commit -am 'Add some feature')
  4. Push to the branch. (git push origin my-new-feature)
  5. Create new Pull Request.

django-grappelli-extensions's People

Contributors

gotlium avatar leonty avatar lerrua avatar lumasepa avatar mauler avatar ogu2 avatar raphapassini avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.