[8352] breaks simple list display. to reproduce,
# models.py
class Site(models.Model):
name = models.CharField(max_length=255)
def __unicode__(self):
return self.name
# admin.py
from django.contrib import admin
from visitdb import models as visitdb
admin.site.register(visitdb.Site)
go to /admin, and click on Site.
Environment:
Request Method: GET
Request URL: http://localhost:8000/django-admin/visitdb/site/
Django Version: 1.0-alpha_2-SVN-8352
Python Version: 2.5.2
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.humanize',
'visitdb',
'photologue']
Installed Middleware:
('visitdb.middleware.RequestAttributeSetup',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware',
'visitdb.middleware.StandardViewKwargsMiddleware')
Template error:
In template /home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/contrib/admin/templates/admin/change_list.html, error at line 34
Caught an exception while rendering: local variable 'attr' referenced before assignment
24 : {% if cl.has_filters %}
25 : <div id="changelist-filter">
26 : <h2>{% trans 'Filter' %}</h2>
27 : {% for spec in cl.filter_specs %}
28 : {% admin_list_filter cl spec %}
29 : {% endfor %}
30 : </div>
31 : {% endif %}
32 : {% endblock %}
33 :
34 : {% block result_list %} {% result_list cl %} {% endblock %}
35 : {% block pagination %}{% pagination cl %}{% endblock %}
36 : </div>
37 : </div>
38 : {% endblock %}
39 :
Traceback:
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/core/handlers/base.py" in get_response
86. response = callback(request, *callback_args, **callback_kwargs)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/contrib/admin/sites.py" in root
172. return self.model_page(request, *url.split('/', 2))
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/views/decorators/cache.py" in _wrapped_view_func
44. response = view_func(request, *args, **kwargs)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/contrib/admin/sites.py" in model_page
189. return admin_obj(request, rest_of_url)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/contrib/admin/options.py" in __call__
267. return self.changelist_view(request)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/contrib/admin/options.py" in changelist_view
719. ], context, context_instance=template.RequestContext(request))
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/shortcuts/__init__.py" in render_to_response
18. return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/template/loader.py" in render_to_string
107. return t.render(context_instance)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/template/__init__.py" in render
176. return self.nodelist.render(context)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/template/__init__.py" in render
751. bits.append(self.render_node(node, context))
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/template/debug.py" in render_node
71. result = node.render(context)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/template/loader_tags.py" in render
97. return compiled_parent.render(context)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/template/__init__.py" in render
176. return self.nodelist.render(context)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/template/__init__.py" in render
751. bits.append(self.render_node(node, context))
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/template/debug.py" in render_node
71. result = node.render(context)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/template/loader_tags.py" in render
97. return compiled_parent.render(context)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/template/__init__.py" in render
176. return self.nodelist.render(context)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/template/__init__.py" in render
751. bits.append(self.render_node(node, context))
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/template/debug.py" in render_node
71. result = node.render(context)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/template/loader_tags.py" in render
24. result = self.nodelist.render(context)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/template/__init__.py" in render
751. bits.append(self.render_node(node, context))
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/template/debug.py" in render_node
71. result = node.render(context)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/template/loader_tags.py" in render
24. result = self.nodelist.render(context)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/template/__init__.py" in render
751. bits.append(self.render_node(node, context))
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/template/debug.py" in render_node
81. raise wrapped
Exception Type: TemplateSyntaxError at /django-admin/visitdb/site/
Exception Value: Caught an exception while rendering: local variable 'attr' referenced before assignment
Original Traceback (most recent call last):
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/template/debug.py", line 71, in render_node
result = node.render(context)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/template/__init__.py", line 898, in render
dict = func(*args)
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/contrib/admin/templatetags/admin_list.py", line 235, in result_list
'result_headers': list(result_headers(cl)),
File "/home/tobias/caktus/eclipse-workspace/blueridge_visit_database/django/contrib/admin/templatetags/admin_list.py", line 110, in result_headers
admin_order_field = getattr(attr, "admin_order_field", None)
UnboundLocalError: local variable 'attr' referenced before assignment
Whoops. Completely missed a couple cases. Thanks for report. Working on it now.