tomchristie/django-rest-framework — Issue #84: Template error, 'list' object has no attribute 'select_related' in renderer.html
Author: meurig
Created: 2011-10-31 04:23:47+00:00
State: open

This bug appears to have been introduced since v0.2.3 on pipi. I only see it when running the git master version.

Environment:

Request Method: GET
Request URL: http://www.example.com/mayan/rest_api/v1/documents/1/

Django Version: 1.3
Python Version: 2.6.6
Installed Applications:
['grappelli',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'django.contrib.admindocs',
'django.contrib.comments',
'django.contrib.staticfiles',
'djangorestframework',
'project_setup',
'project_tools',
'smart_settings',
'navigation',
'lock_manager',
'web_theme',
'common',
'metadata',
'pagination',
'dynamic_search',
'filetransfers',
'converter',
'permissions',
'djcelery',
'indexer',
'paging',
'sentry',
'sentry.client',
'sentry.client.celery',
'storage',
'folders',
'taggit',
'tags',
'document_comments',
'user_management',
'documents',
'grouping',
'mptt',
'document_indexing',
'ocr',
'sources',
'mimetype',
'scheduler',
'job_processor',
'history',
'main']
Installed Middleware:
('common.middleware.strip_spaces_widdleware.SpacelessMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'common.middleware.login_required_middleware.LoginRequiredMiddleware',
'permissions.middleware.permission_denied_middleware.PermissionDeniedMiddleware',
'pagination.middleware.PaginationMiddleware')

Template error:
In template /home/meurig/djcode/django-rest-framework/djangorestframework/templates/renderer.html, error at line 94
Caught AttributeError while rendering: 'list' object has no attribute 'select_related'
84 :

85 :	{% endif %}

86 :

87 :	{% if 'PUT' in view.allowed_methods %}

88 :

89 :

90 :

PUT {{ name }}

91 :

92 :	{% csrf_token %}

93 :	{{ put_form.non_field_errors }}

94 :	{% for field in put_form %}

95 :

96 :	{{ field.label_tag }}

97 :	{{ field }}

98 :	{{ field.help_text }}

99 :	{{ field.errors }}

100 :

101 :	{% endfor %}

102 :

103 :

104 :

Traceback:
File "/var/www/mayan/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response
111. response = callback(request, *callback_args, **callback_kwargs)
File "/var/www/mayan/lib/python2.6/site-packages/django/views/generic/base.py" in view
47. return self.dispatch(request, *args, **kwargs)
File "/var/www/mayan/lib/python2.6/site-packages/django/views/decorators/csrf.py" in wrapped_view
39. resp = view_func(*args, **kwargs)
File "/var/www/mayan/lib/python2.6/site-packages/django/views/decorators/csrf.py" in wrapped_view
52. return view_func(*args, **kwargs)
File "/home/meurig/djcode/django-rest-framework/djangorestframework/views.py" in dispatch
162. return self.render(response)
File "/home/meurig/djcode/django-rest-framework/djangorestframework/mixins.py" in render
259. content = renderer.render(response.cleaned_content, media_type)
File "/home/meurig/djcode/django-rest-framework/djangorestframework/renderers.py" in render
332. ret = template.render(context)
File "/var/www/mayan/lib/python2.6/site-packages/django/template/base.py" in render
123. return self._render(context)
File "/var/www/mayan/lib/python2.6/site-packages/django/template/base.py" in _render
117. return self.nodelist.render(context)
File "/var/www/mayan/lib/python2.6/site-packages/django/template/base.py" in render
744. bits.append(self.render_node(node, context))
File "/var/www/mayan/lib/python2.6/site-packages/django/template/debug.py" in render_node
73. result = node.render(context)
File "/var/www/mayan/lib/python2.6/site-packages/django/template/defaulttags.py" in render
311. return self.nodelist_true.render(context)
File "/var/www/mayan/lib/python2.6/site-packages/django/template/base.py" in render
744. bits.append(self.render_node(node, context))
File "/var/www/mayan/lib/python2.6/site-packages/django/template/debug.py" in render_node
73. result = node.render(context)
File "/var/www/mayan/lib/python2.6/site-packages/django/template/defaulttags.py" in render
311. return self.nodelist_true.render(context)
File "/var/www/mayan/lib/python2.6/site-packages/django/template/base.py" in render
744. bits.append(self.render_node(node, context))
File "/var/www/mayan/lib/python2.6/site-packages/django/template/debug.py" in render_node
73. result = node.render(context)
File "/var/www/mayan/lib/python2.6/site-packages/django/template/defaulttags.py" in render
227. nodelist.append(node.render(context))
File "/var/www/mayan/lib/python2.6/site-packages/django/template/debug.py" in render
92. output = force_unicode(output)
File "/var/www/mayan/lib/python2.6/site-packages/django/utils/encoding.py" in force_unicode
71. s = unicode(s)
File "/var/www/mayan/lib/python2.6/site-packages/django/forms/forms.py" in __unicode__
408. return self.as_widget()
File "/var/www/mayan/lib/python2.6/site-packages/django/forms/forms.py" in as_widget
439. return widget.render(name, self.value(), attrs=attrs)
File "/var/www/mayan/lib/python2.6/site-packages/taggit/forms.py" in render
10. value = edit_string_for_tags([o.tag for o in value.select_related("tag")])

Exception Type: TemplateSyntaxError at /rest_api/v1/documents/1/
Exception Value: Caught AttributeError while rendering: 'list' object has no attribute 'select_related'