Giter Club home page Giter Club logo

django-admin-overlay's Introduction

Django admin-overlay

This package displays an overlay (i.e. toolbar) at the frontend pages, when the user is logged in as administrator. It makes it easier to navigate through the site, or add a frontend-editoring toolbar to your project. This is implemented as Django middleware, which can be extended and customized for your own projects.

Feel free to fork the project, and contribute patches!

Installation

The setup.py has to suffice for now:

python setup.py install

Enabling the overlay

Settings to add:

INSTALLED_APPS += (
    'admin_overlay',
)

MIDDLEWARE_CLASSES += (
    'admin_overlay.middleware.AdminOverlayMiddleware',
)

Next, the static files can be linked:

./manage.py collectstatic --link

Optionally you can override the templates:

  • admin_overlay/head_end.html: is added just before the </head> tag.
  • admin_overlay/body_start.html: is added just after the <body> tag.
  • admin_overlay/body_end.html: is added just before the </body> tag.

The templates receive a RequestContext with the request field. No other context information is given.

Extending the overlay

It's perfectly fine (even encouraged) to inhert the AdminOverlayMiddleware class, to add your own presentation logic. The class defines some public settings, and methods which you can override.

The settings are:

  • allowed_status_codes: which HTTP status codes should enable the overlay. By default 200.
  • allowed_content_types: which content type does the overlay respond to? By default text/html and application/xhtml+xm.
  • head_end_template: which template to use for the content before the </head> tag, By default admin_overlay/head_end.html.
  • body_start_template: which template to use for the content after the <body> tag. By default admin_overlay/body_start.html.
  • body_end_template: which template to use for the content before the </body> tag. By default admin_overlay/body_end.html.

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.