views:

660

answers:

3

I like the very simple but still really elegant look and feel of the django admin and I was wondering if there is a way to apply it to my own application.

(I think that I've read something like that somewhere, but now I cannot find the page again.)

(edited: what I am looking for is a way to do it automatically by extending templates, importing modules, or something similar, not just copy&paste the css and javascript code)

A: 

edit: I misread the question.

you can delete your answer you know?
muhuk
+3  A: 

Well are you sure you want to take every bit of admin site look & feel?? I think you would need to customize some as in header footer etc.

Well to do that, just copy base.html from

"djangosrc/contrib/admin/templates/admin/"

and keep it in

"your_template_dir/admin/base.html" or "your_template_dir/admin/mybase.html"

Just change whatever HTML you want to customize and keep rest as it is (like CSS and Javascript) and keep on extending this template in other templates of your application. Your view should provide what it needs to render (take a look at any django view from source) and you'll have everything what admin look & feel had. More you can do by extending base_site.html in same manner.

(Note: if you keep the name 'base.html' the changes you make in html will effect on Django Admin too. As this is the way we change how Django Admin look itself)

simplyharsh
+2  A: 
{% extends "admin/base_site.html" %}

is usually a good place to start but do look at the templates in contrib/admin/templates and copy some of the techniques there.

andybak