Customizing the Django Admin Interface

91 views
Skip to first unread message

JJ Zolper

unread,
Sep 16, 2012, 2:25:18 AM9/16/12
to django...@googlegroups.com
Hello,

I was able to locate the Django files for the admin under contrib in the source. I was curious if I could get some tips about customizing the interface.

One website I read said I shouldn't change any of the Django source but if I want to set up a slightly different login page for example, to put the admin files in my local directories that I'm working with.

The real question is that I was able to edit some template files to change some of the wording displayed but when I tried to edit the CSS files to get a different design I did not see any changes when I restarted my server. Is there some sort of collectstatic command that needs to be run? Any input on how to propagate these CSS files through would be great.

Thanks,

JJ Zolper

Gurpreet Bhatia

unread,
Sep 16, 2012, 2:52:34 AM9/16/12
to django...@googlegroups.com
Hi Everyone,

I have one query:

Should we change the database(mySQL) table's engine through migration scripts or not? If not then why?

Following were my proposal:

def forwards(self, orm):
 
        # Change engine from MYISAM to INNODB
        db.execute('alter table abc ENGINE=INNODB;')

    def backwards(self, orm):

       # Revert Engine to MYISAM
        db.execute('alter table abc ENGINE=MYISAM;')

- gurpreet

Derek

unread,
Sep 17, 2012, 3:09:26 AM9/17/12
to django...@googlegroups.com
Hi JJ

I'd like to know how you changed the wording... I cannot seem to find the source text, for example, for "Select ... to change"
and would appreciate seeing/knowing how you did it.

There are examples on various blogs, but Django has changed how it is works since they were written.

Thanks
Derek

JJ Zolper

unread,
Sep 17, 2012, 4:57:30 PM9/17/12
to django...@googlegroups.com
Hevok so what are the steps for doing this?

Sure I know where the admin files are located but once I have copied them does magic just happen and Django uses my new configurations?

Thanks,

JJ

PS. apparently after I left my website alone for a little the CSS propagated through and now I see this:


Which has the red, different text color, etc.

On Sunday, September 16, 2012 4:34:10 AM UTC-4, hevok wrote:
Its the correct way to copy the templates and static files into your
project folder, if you want to customize them. Otherwise the changes
would disappear as soon as you deploy or setup-up your project on a
different computer/virtual environment.

Try F5, CTRL-F5 or CTRL-R to reload CSS in the browser as they are often
kept in cache.

Best regards,
Hevok

JJ Zolper

unread,
Sep 17, 2012, 4:58:01 PM9/17/12
to django...@googlegroups.com
Pretty sure you're in the wrong thread bud.

JJ Zolper

unread,
Sep 17, 2012, 5:00:20 PM9/17/12
to django...@googlegroups.com
Derek,

You can see the custom changes I made here:


That is the extent of what I have done in relation to the default. Nothing more then some colors in the CSS and text color. Additionally I changed the actual wording for the <title></title> to  <title>Log in | MadTrak Django Admin</title> other then that text change and the colors I'm not sure what you are asking?

What is:

I cannot seem to find the source text, for example, for "Select ... to change"
and would appreciate seeing/knowing how you did it.

referring to?

JJ

hevok

unread,
Sep 17, 2012, 9:07:13 PM9/17/12
to django...@googlegroups.com
Well, yes. The magic pony is doing everything for you, if you just treat it correctly!

Basically, put the modified admin templates and static files exactly there were you are serving your own templates and static assets normally in you project directory.
For instance, treat the admin as an app and place the customized templates into `templates/admin/`. Django will first look in your own directory and use the files there.

These two videos might be of interest regarding this topic:
1. http://pyvideo.org/video/576/customizing-the-django-admin
2. http://pyvideo.org/video/56/djangocon-2010--customizing-the-django-admin

There is also django-grappelli which illustrates how to customize the admin in an excellent way.

Regards,
Hevok

Derek

unread,
Sep 18, 2012, 2:59:20 AM9/18/12
to django...@googlegroups.com
The text  I am referring to is the one that appears as a title on all the change list pages; I cannot, however, find it in the change_list template.  But if you have not needed to change that, then you would not be able to help.

(PS I was not asking to see the result of your changes, but where in the source code you had made them...)
Reply all
Reply to author
Forward
0 new messages