Skip to content

a minimally invasive Django admin theme, styled after Wordpress' < 3.8

License

Notifications You must be signed in to change notification settings

kezabelle/django-thadminjones

Repository files navigation

Thadmin Jones 0.1.0

thadminjones is a package for the Django admin backend, implementing a new theme, reminiscent of the Wordpress administration.

It's less of a whole-sale replacement than many other packages, insofar as only the following templates have been changed:

  • admin/base_site.html
  • admin/filter.html

and the existing CSS is built upon, rather than thrown out to start from scratch.

Due to the non-intrusive nature of the theme, things like nice responsive changelist tables haven't been addressed.

The license

Let us get this out of the way. It's GPLv2. Not the license I'd have picked, but Wordpress is also GPLv2, and as this is probably considered a derivitive work, the viral nature of the GPL requires this be GPL compatible, and I don't know licenses enough to make an informed decision as to whether another license would be permissable.

I'm sorry if that means you can't use this, or contribute to it.

How to install

Edit your INSTALLED_APPS to reflect the new package:

INSTALLED_APPS = (
  'thadminjones',
  'django.contrib.admin',
)

Due to the way templates are discovered, you must explicitly opt-in to using the thadminjones templates, which means the package must be before the standard admin package.

Alternatively, if you have any TEMPLATE_DIRS which include any of the following templates, you may need to adapt those to include the template changes required by thadminjones:

  • admin/base_site.html
  • admin/filter.html

Features

The quick add menu

As a convienience, it is possible to have certain ModelAdmin instances listed in a Quick Add menu at the top of every page; to enable a ModelAdmin in this menu, you can either inherit from the SupportsQuickAdd mixin class:

from thadminjones.admin import SupportsQuickAdd

class MyModelAdmin(SupportsQuickAdd, ModelAdmin):
    pass

or you can define has_quick_add_permission and get_quick_add_url methods on your existing ModelAdmin. See the implementation of the mixin class for implementation info.

What about third party apps?

Other apps can have styles pulled in by including a file in:

<app.name>/static/<last.part.of.app.name>/css/thadminjones.css

They will be put in the right place by the collectstatic management command, and are discovered by a template tag in the bundled admin/base_site.html which looks for certain filenames using the AppDirectories staticfiles finder.

By way of example, take the minor changes made to django-treeadmin:

  • The <app.name> that is used in INSTALLED_APPS is thadminjones.contrib.treeadmin
  • The CSS is in static/treeadmin/css - the <last.part.of.app.name>; only the last part of the dot path is used, allowing us to provide tweaks to third party packages without reaching out and asking them to bundle said tweaks.

About the name

It's a play on words, a reference to Thad Jones, a Jazz musician. I'm hardly alone in naming Django packages in relation to Jazz, as off the top of my head I can think of:

Screenshots

The following images are vaguely representative of the theme, though there may be discrepencies because taking screenshots every time I fix or change something is likely to be tiresome. They've been scrubbed by ImageOptim too...

Login

AdminSite index

Listing users in the test project

Editing a user in the test project

Logout screen

Contributing

The quickest way to get up and running to contribute is:

$ mkvirtualenv thadmin
$ git clone git@github.com:kezabelle/django-thadminjones.git
$ python django-thadminjones/setup.py develop

Which will install all the requirements for running the test_project, thereafter, you can spin up a clean-room project accessible at 127.0.0.1:8080 by doing:

$ python django-thadminjones/test_project/run.py

Tickets can be opened on the django-thadminjones GitHub repository - if you're reporting a visual bug, please try to include a screenshot illustrating the problem, or a pull request for the test_project to demonstrate it.

About

a minimally invasive Django admin theme, styled after Wordpress' < 3.8

Resources

License

Stars

Watchers

Forks

Packages