Error while customizing admin/change_form.html

488 views
Skip to first unread message

Owais Lone

unread,
Jun 15, 2010, 3:37:35 AM6/15/10
to Django users
Hey everyone..

I was trying to customize django's admin interface but a problem has
occurred.



here is my code in change_form.html

{% extends "admin/change_form.html" %}

{% block form_top %}
<p>Insert meaningful help message here...</p>
{% endblock %}



and here is the error

TemplateSyntaxError at /admin/blog/entry/add/

Caught RuntimeError while rendering: maximum recursion depth exceeded
while calling a Python object

Request Method: GET
Request URL: http://127.0.0.1:8000/admin/blog/entry/add/
Django Version: 1.2.1
Exception Type: TemplateSyntaxError
Exception Value:

Caught RuntimeError while rendering: maximum recursion depth exceeded
while calling a Python object

Exception Location: /usr/local/lib/python2.6/dist-packages/django/
utils/text.py in unescape_string_literal, line 273
Python Executable: /usr/bin/python
Python Version: 2.6.5


Template error

In template /home/owais/Projects/curry/curry/static/templates/admin/
change_form.html, error at line 1
Caught RuntimeError while rendering: maximum recursion depth exceeded
1 {% extends "admin/change_form.html" %}
2
3 {% block form_top %}

igor.potapenko

unread,
Jun 15, 2010, 10:06:04 AM6/15/10
to Django users

> here is my code in change_form.html
>
> {% extends "admin/change_form.html" %}

... and ...

> Caught RuntimeError while rendering: maximum recursion depth exceeded

You try to extend template with itself.

Richard Bolt

unread,
Jun 17, 2010, 8:33:51 PM6/17/10
to Django users
You're getting a recursion error because you're trying to extend admin/
change_form.html with itself. In other words your copy of admin/
change_form.html in the directory location you have is the default
admin/change_form.html template now...

You can either:
1. Copy the entire admin/change_form.html template into your file
(You'll then be replacing the default template with whatever you cook
up), or
2. Override the change_form.html on a per app, or model, basis as per
the admin documentation here: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates

Hope that helps :-)

I159

unread,
Jul 16, 2011, 6:30:00 AM7/16/11
to django...@googlegroups.com
Or simply add folder with same name of your app. For <template_folder>admin/<app_label>/<template>.html
Reply all
Reply to author
Forward
0 new messages