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!
The setup.py
has to suffice for now:
python setup.py install
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.
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 defaulttext/html
andapplication/xhtml+xm
.head_end_template
: which template to use for the content before the</head>
tag, By defaultadmin_overlay/head_end.html
.body_start_template
: which template to use for the content after the<body>
tag. By defaultadmin_overlay/body_start.html
.body_end_template
: which template to use for the content before the</body>
tag. By defaultadmin_overlay/body_end.html
.