Thursday, June 27, 2013

Re: Customize the admin look and feel

Try it like this:

TEMPLATE_DIRS = (
    "C:/xampp/htdocs/mytemplates/"
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.

)

You are expected to list locations (in other words: directories, hence the DIRS part) of where the loader will look for templates, in search order. [see https://docs.djangoproject.com/en/1.5/ref/settings/#template-dirs]

Since the docs are not really descriptive there, here is a simplified explanation:
When defining the template to be used with a context, built in a view, you will always give a relative path, starting from any path you set in TEMPLATE_DIRS, at least that is how you can easily remember what to put where.
The same principle works for the admin views. The view is telling the loader to load the template "admin/base_site.html", so the loader will prepend each template_dirs to that starting with the first, checking if there is a template there and return it when its found.

Hope that helps.


Am Donnerstag, 27. Juni 2013 18:46:40 UTC+2 schrieb krazyXplorer:
I am new to Django and got stuck at

Tutorial 2 - Customize the admin look and feel


When I directly went into C:\Python27\Lib\site-packages\django\contrib\admin\templates\admin\base_site.html and made changes in base_site.html there was no problem and I didn't even had to edit the TEMPLATE_DIRS (...)


But When I copy the base_site.html into C:\xampp\htdocs\mytemplates\admin and edit TEMPLATE_DIRS (...)  to

TEMPLATE_DIRS = (
    "C:/xampp/htdocs/mytemplates/admin/base_site.html"
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.

)

There was no Change in admin look

Please help ..what am I doing wrong ??

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment