13👍
The recursion error is because you’re extending the admin/index.html
with itself.
You can either:
- copy the entire
admin/index.html
template in yourtemplates/admin/
directory, and it will replace the default template with yours - override the
index.html
per app or model, as explained here
I know this is late after the question, but you know, google traveling…
7👍
Amend settings.py with an extra template folder, for example:
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
"/home/mysite/webapps/django/myproject/templates",
"/home/mysite/webapps/django/lib/python2.7/django/", # extra folder
)
Then in myproject/templates/admin add your own index.html like:
{% extends "contrib/admin/templates/admin/index.html" %}
{% block branding %}
<h1 id="site-name">Administration for TheLittleButtonCo</h1>
{% endblock %}
Variations are possible, obviously. This works on Django 1.3.1 final
- Serving static files with Nginx + Gunicorn + Django
- Iterating over a Django QuerySet while deleting objects in the same QuerySet
- GenericForeignKey and Admin in Django
- 'WSGIRequest' object has no attribute 'Post'
- How to handle Python multiprocessing database concurrency, specifically with django?
1👍
Not sure if you found the answer, but you need to change
{% extends "admin/index.html" %}
to
{% extends "admin/base_site.html" %}
as that is what the original index.html page overwrites. Because the Django system searches your templates folder before using the default admin one, so in this case it finds the admin/index.html in your templates, then it’s trying to extend itself with the extend (hence the recursion error).
For reference you can customise the base_site.html
in you templates too, it extends base.html
. The best thing to do is copy the original from:
/usr/local/lib/python2.6/dist-packages/django/contrib/admin/templates/
and paste it into your templates folder as a starting point
- How to measure the time profile of each django test?
- Printing Receipt from Django Web Application
- What type files should be put into .gitignore file in Django project
- How do I delete a cached template fragment in Django?
- Generate update query using django orm
- Django: When to run makemigrations?
- Django-admin.py startproject mysite not working well on windows 7
- How to make a customizable user survey in Django
- How to pass choice display name to model serialize in Django REST framework?
- Returning a value with psycopg2