views:

57

answers:

1

Hi, I am learning django and building my own project.
I want to change the admin section to my own interface, I have added sub-directory to the templates names "admin".And started change the base.html

The problems are-

  • I want to add my own css file, how I can do it?My css file is located on my MEDIA_ROOT directory.How I can do that?
  • I saw a lot of template tags,Where I can see which template tags are available to me on the admin section?
  • There is a clean admin template like Starkers for Wordpress
  • Yosy

    +1  A: 

    1) If "django.core.context_processors.media" is included in TEMPLATE_CONTEXT_PROCESSORS (which is by default) in your settings.py, you can add <link> to {{ MEDIA_URL }}/your_stylesheet.css in templates/admin/base.html, like so (I'm using Django 1.2 admin templates):

    ...
    <link rel="stylesheet" type="text/css" href="{% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/base.css{% endblock %}" />
    <link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}/your_stylesheet.css" />
    ...
    

    2) You can use all tags everywhere, if you {%load%}ed them before. There are admin specific tags, which could be found in Django source here - unfortunately I'm not aware of any docs about them, so seems like you have to read the source.

    3) I haven't heard about such thing for Django admin, there is however project named Grappelli that improves Django admin looks and functionality, providing slightly friendlier templates as side effect.

    cji
    Thanks a lot everything is fixed ^_^I didn`t had TEMPLATE_CONTEXT_PROCESSORS so I added it to my code manually.
    Yosy