I wonder whether it is possible to use Django in-built comments framework for other pages, that is not related to "blog entries". For example I want to add comments field on each every page about a movie.
I tried to follow the instructions here https://docs.djangoproject.com/en/dev/ref/contrib/comments/ but got the following error. I already added the necessary APP, and did syncdb.
Environment:
Request Method: GET
Request URL: http://localhost:8000/movie/603/
Django Version: 1.4
Python Version: 2.7.2
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'forms',
'social_auth')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')
Template error:
In template C:\xampp\htdocs\tddd27_project\templates\movie_info.html, error at line 3
'comments' is not a valid tag library: Template library comments not found, tried django.templatetags.comments,django.contrib.staticfiles.templatetags.comments,django.contrib.admin.templatetags.comments,forms.templatetags.comments
1 : {% extends "base.html" %}
2 : {% load string_extras %}
3 : {% load comments %}
4 : {% block title %}{{ content.original_title }}{% endblock title %}
5 : {% block content %}
6 :
7 : <h2>{{ content.original_title }} - ({{ content.release_date|year}})</h2>
8 : <table>
9 : <tr>
10 : <td><img src="http://cf2.imgobject.com/t/p/w185/{{ content.poster_path}}"></td>
11 : <td>{{ content.overview }}</td>
12 : </tr>
13 :
Traceback:
File "c:\tools\python27\lib\site-packages\django-1.4-py2.7.egg\django\core\handlers\base.py" in get_response
111. response = callback(request, *callback_args, **callback_kwargs)
File "C:\xampp\htdocs\tddd27_project\views.py" in movie_view
65. return render_to_response('movie_info.html',{'content':content}, RequestContext(request))
File "c:\tools\python27\lib\site-packages\django-1.4-py2.7.egg\django\shortcuts\__init__.py" in render_to_response
20. return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
File "c:\tools\python27\lib\site-packages\django-1.4-py2.7.egg\django\template\loader.py" in render_to_string
169. t = get_template(template_name)
File "c:\tools\python27\lib\site-packages\django-1.4-py2.7.egg\django\template\loader.py" in get_template
145. template, origin = find_template(template_name)
File "c:\tools\python27\lib\site-packages\django-1.4-py2.7.egg\django\template\loader.py" in find_template
134. source, display_name = loader(name, dirs)
File "c:\tools\python27\lib\site-packages\django-1.4-py2.7.egg\django\template\loader.py" in __call__
42. return self.load_template(template_name, template_dirs)
File "c:\tools\python27\lib\site-packages\django-1.4-py2.7.egg\django\template\loader.py" in load_template
48. template = get_template_from_string(source, origin, template_name)
File "c:\tools\python27\lib\site-packages\django-1.4-py2.7.egg\django\template\loader.py" in get_template_from_string
156. return Template(source, origin, name)
File "c:\tools\python27\lib\site-packages\django-1.4-py2.7.egg\django\template\base.py" in __init__
125. self.nodelist = compile_string(template_string, origin)
File "c:\tools\python27\lib\site-packages\django-1.4-py2.7.egg\django\template\base.py" in compile_string
153. return parser.parse()
File "c:\tools\python27\lib\site-packages\django-1.4-py2.7.egg\django\template\base.py" in parse
267. compiled_result = compile_func(self, token)
File "c:\tools\python27\lib\site-packages\django-1.4-py2.7.egg\django\template\loader_tags.py" in do_extends
214. nodelist = parser.parse()
File "c:\tools\python27\lib\site-packages\django-1.4-py2.7.egg\django\template\base.py" in parse
267. compiled_result = compile_func(self, token)
File "c:\tools\python27\lib\site-packages\django-1.4-py2.7.egg\django\template\defaulttags.py" in load
1043. (taglib, e))
Exception Type: TemplateSyntaxError at /movie/603/
Exception Value: 'comments' is not a valid tag library: Template library comments not found, tried django.templatetags.comments,django.contrib.staticfiles.templatetags.comments,django.contrib.admin.templatetags.comments,forms.templatetags.comments
Can you see something missing here?
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'forms',
'social_auth')
django.contrib.comments does not appear to be in that list...
Related
I'm building a GIS-related web application, and the way it displays the contents of the database on a map is pretty straightforward: the view collects several (currently 122) GeoJSON files and passes them to the template. The template iterates all of them and displays them (using Leaflet). However, I cannot manage to make it work, as every attempt results in a Memory Error.
The database I'm using is a PostgreSQL one, in case it helps. I'm also using a TextField in the model, is it possible that to be source of the issue?
Any advice will be much appreciated :)
The view:
geodata = GeojsonData.objects.filter(connection = my_con).iterator()
view = "map"
return render(request, "map.html", {'geojsonData': geodata})
The template:
{% for dat in geojsonData %}
{% with dat.name as name %}
{% with dat.geodata as gj %}
{{gj}}
L.geoJSON(name).addTo(map);
{% endwith %}
{% endwith %}
{% endfor %}
The model:
class GeojsonData(models.Model):
name = models.CharField(max_length=2000, unique=True)
connection= models.ForeignKey(Connection, related_name='Connection', default=1)
geodata = models.TextField()
The traceback:
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/map/1/
Django Version: 1.11.4
Python Version: 3.6.2
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'myapp.apps.myappConfig']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback:
File "C:\Users\Xabi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\handlers\exception.py" in inner
41. response = get_response(request)
File "C:\Users\Xabi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\handlers\base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "C:\Users\Xabi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\handlers\base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\Xabi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\contrib\auth\decorators.py" in _wrapped_view
23. return view_func(request, *args, **kwargs)
File "C:\Users\Xabi\Desktop\...\views.py" in mapa
92. return render(request, "map.html", {'geojsonData': geodata})
File "C:\Users\Xabi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\shortcuts.py" in render
31. return HttpResponse(content, content_type, status)
File "C:\Users\Xabi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\http\response.py" in __init__
303. self.content = content
File "C:\Users\Xabi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\http\response.py" in content
336. content = self.make_bytes(value)
File "C:\Users\Xabi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\http\response.py" in make_bytes
247. return bytes(value.encode(self.charset))
File "C:\Users\Xabi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py" in _curried
15. return _curried_func(*(args + moreargs), **dict(kwargs, **morekwargs))
File "C:\Users\Xabi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\safestring.py" in _proxy_method
107. return SafeBytes(data)
Exception Type: MemoryError at /map/1/
Exception Value:
Not sure if you've already solved your problem. But maybe instead of doing the loop in your template, you can do the loop in python and pass the end result to your template?
I made a few modifications to my model, adding some image fields and installing Pillow, deleteing some models or model fields.
As Site is not yet in production, I simply dropped the database and re-created it, and synced it. Then I got this error.
I can't figure out what could be the source of this sudden error. In the settings.py I added a media_root but nothing else.
Environment:
Request Method: GET
Request URL: http://localhost:8000/
Django Version: 1.6.2
Python Version: 3.4.0
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'backoffice',
'public',
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.facebook',
'allauth.socialaccount.providers.google',
'allauth.socialaccount.providers.twitter',
'widget_tweaks',
'rosetta',
'debug_toolbar',
'template_debug')
Installed Middleware:
('debug_toolbar.middleware.DebugToolbarMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware')
Template error:
In template C:\Python34\lib\site-packages\debug_toolbar\templates\debug_toolbar\base.html, error at line 5
'list' does not support the buffer interface
1 : {% load i18n %}{% load static from staticfiles %}{% load url from future %}
2 : <style type="text/css">
3 : #media print { #djDebug {display:none;}}
4 : </style>
5 : <link rel="stylesheet" href=" {% static 'debug_toolbar/css/toolbar.css' %} " type="text/css" />
6 : {% if toolbar.config.JQUERY_URL %}
7 : <script src="{{ toolbar.config.JQUERY_URL }}"></script>
8 : <script>var djdt = {jQuery: jQuery.noConflict(true)};</script>
9 : {% else %}
10 : <script>var djdt = {jQuery: jQuery};</script>
11 : {% endif %}
12 : <script src="{% static 'debug_toolbar/js/toolbar.js' %}"></script>
13 : <div id="djDebug" style="display:none;" dir="ltr"
14 : data-store-id="{{ toolbar.store_id }}" data-render-panel-url="{% url 'djdt:render_panel' %}"
15 : {{ toolbar.config.ROOT_TAG_EXTRA_ATTRS|safe }}>
Traceback:
File "C:\Python34\lib\site-packages\django\core\handlers\base.py" in get_response
201. response = middleware_method(request, response)
File "C:\Python34\lib\site-packages\debug_toolbar\middleware.py" in process_response
121. bits[-2] += toolbar.render_toolbar()
File "C:\Python34\lib\site-packages\debug_toolbar\toolbar.py" in render_toolbar
68. return render_to_string('debug_toolbar/base.html', context)
File "C:\Python34\lib\site-packages\django\template\loader.py" in render_to_string
164. return t.render(Context(dictionary))
File "C:\Python34\lib\site-packages\django\template\base.py" in render
140. return self._render(context)
File "C:\Python34\lib\site-packages\django\test\utils.py" in instrumented_test_render
85. return self.nodelist.render(context)
File "C:\Python34\lib\site-packages\django\template\base.py" in render
840. bit = self.render_node(node, context)
File "C:\Python34\lib\site-packages\django\template\debug.py" in render_node
78. return node.render(context)
File "C:\Python34\lib\site-packages\django\templatetags\static.py" in render
106. url = self.url(context)
File "C:\Python34\lib\site-packages\django\contrib\staticfiles\templatetags\staticfiles.py" in url
12. return staticfiles_storage.url(path)
File "C:\Python34\lib\site-packages\django\utils\functional.py" in inner
213. self._setup()
File "C:\Python34\lib\site-packages\django\contrib\staticfiles\storage.py" in _setup
311. self._wrapped = get_storage_class(settings.STATICFILES_STORAGE)()
File "C:\Python34\lib\site-packages\django\contrib\staticfiles\storage.py" in __init__
37. *args, **kwargs)
File "C:\Python34\lib\site-packages\django\core\files\storage.py" in __init__
154. self.location = abspathu(self.base_location)
File "C:\Python34\lib\ntpath.py" in abspath
545. path = _getfullpathname(path)
Exception Type: TypeError at /
Exception Value: 'list' does not support the buffer interface
All right, my fault. Error was in fact pretty explicit.
Unlike the TEMPLATE_DIRS, MEDIA_ROOT is not supposed to be a list.
Django Debug toolbar will return an error every time you mess up with variables types in
the "settings.py" file.
In case anyone does similar mistakes, I'll leave Q&A here.
I'm trying to set up django-openid-auth on my django project. I've followed steps 1-8 of the provided guide and have tried going to /openid/login/ on my server. However, when I go to that page I see
TemplateSyntaxError at /openid/login/
Could not parse the remainder: '-logo' from 'openid-logo'. The syntax of 'url' changed in Django 1.5, see the docs.
I'm a bit confused since this is in a template included in the app - I didn't write the template myself. If anybody knows what I'm doing wrong, I'd really appreciate some help.
Here's my stacktrace:
Environment:
Request Method: GET
Request URL: http://localhost:8000/openid/login/
Django Version: 1.5.2
Python Version: 2.7.5
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.admindocs',
'wseeruploader.apps.fileupload',
'django_openid_auth',
'crispy_forms')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')
Template error:
In template /usr/lib/python2.7/site-packages/django_openid_auth/templates/openid/login.html, error at line 8
Could not parse the remainder: '-logo' from 'openid-logo'. The syntax of 'url' changed in Django 1.5, see the docs.
1 : {% load i18n %}
2 : <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
3 : <html>
4 : <head>
5 : <title>Sign in with your OpenID</title>
6 : <style type="text/css">
7 : input.openid {
8 : background: url( {% url openid-logo %} ) no-repeat;
9 : background-position: 0 50%;
10 : padding-left: 16px;
11 : }
12 : </style>
13 : </head>
14 : <body>
15 : <h1>Sign in with your OpenID</h1>
16 : {% if form.errors %}
17 : <p class="errors">{% trans "Please correct errors below:" %}<br />
18 : {% if form.openid_identifier.errors %}
Traceback:
File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
115. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.7/site-packages/django_openid_auth/views.py" in login_begin
171. }, context_instance=RequestContext(request))
File "/usr/lib/python2.7/site-packages/django/shortcuts/__init__.py" in render_to_response
29. return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
File "/usr/lib/python2.7/site-packages/django/template/loader.py" in render_to_string
170. t = get_template(template_name)
File "/usr/lib/python2.7/site-packages/django/template/loader.py" in get_template
146. template, origin = find_template(template_name)
File "/usr/lib/python2.7/site-packages/django/template/loader.py" in find_template
135. source, display_name = loader(name, dirs)
File "/usr/lib/python2.7/site-packages/django/template/loader.py" in __call__
43. return self.load_template(template_name, template_dirs)
File "/usr/lib/python2.7/site-packages/django/template/loader.py" in load_template
49. template = get_template_from_string(source, origin, template_name)
File "/usr/lib/python2.7/site-packages/django/template/loader.py" in get_template_from_string
157. return Template(source, origin, name)
File "/usr/lib/python2.7/site-packages/django/template/base.py" in __init__
125. self.nodelist = compile_string(template_string, origin)
File "/usr/lib/python2.7/site-packages/django/template/base.py" in compile_string
153. return parser.parse()
File "/usr/lib/python2.7/site-packages/django/template/base.py" in parse
274. compiled_result = compile_func(self, token)
File "/usr/lib/python2.7/site-packages/django/template/defaulttags.py" in url
1266. viewname = parser.compile_filter(bits[1])
File "/usr/lib/python2.7/site-packages/django/template/base.py" in compile_filter
353. return FilterExpression(token, self)
File "/usr/lib/python2.7/site-packages/django/template/base.py" in __init__
570. "from '%s'" % (token[upto:], token))
Exception Type: TemplateSyntaxError at /openid/login/
Exception Value: Could not parse the remainder: '-logo' from 'openid-logo'. The syntax of 'url' changed in Django 1.5, see the docs.
Since you are using django-1.5
You should change:
{% url openid-logo %}
to
{% url 'openid-logo' %}
Relevant documentation can be found in the release notes
The upshot of this is that if you are not using {% load url from future %} in your templates, you’ll need to change tags like {% url myview %} to {% url "myview" %}. If you were using {% load url from future %} you can simply remove that line under Django 1.5
Sorry to post yet another question related to the error:
'WSGIRequest' object has no attribute 'find'
But I really can't find the answer anywhere.
I'm trying to use the django_model_comments app, which extends django's included comment app.
Did everything the page tells, however when running the server, I get the following:
Environment:
Request Method: GET
Request URL: http://localhost:8000/feed/1
Django Version: 1.4.3
Python Version: 2.7.2
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'model_comments',
'django.contrib.comments',
'pinax_theme_bootstrap_account',
'pinax_theme_bootstrap',
'django_forms_bootstrap',
'account',
'metron',
'user_app',
'feed_app']
Installed Middleware:
['django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware']
Template error:
In template D:\Docs\Work\repo\project\feed_app\templates\feed.html, error at line 10
'WSGIRequest' object has no attribute 'find'
1 : {% load model_comment_tags %}
2 : {% get_comment_form for feed as post_form %}
3 : {% render_comment_form post_form %}
Traceback:
File "D:\Docs\Work\repo\so_virtual_env\lib\site-packages\django\core\handlers\base.py" in get_response
111. response = callback(request, *callback_args, **callback_kwargs)
File "D:\Docs\Work\repo\project\feed_app\views.py" in get_user_feed
37. 'feed': private_feed})
File "D:\Docs\Work\repo\so_virtual_env\lib\site-packages\django\template\base.py" in render
140. return self._render(context)
File "D:\Docs\Work\repo\so_virtual_env\lib\site-packages\django\template\base.py" in _render
134. return self.nodelist.render(context)
File "D:\Docs\Work\repo\so_virtual_env\lib\site-packages\django\template\base.py" in render
823. bit = self.render_node(node, context)
File "D:\Docs\Work\repo\so_virtual_env\lib\site-packages\django\template\debug.py" in render_node
74. return node.render(context)
File "D:\Docs\Work\repo\so_virtual_env\lib\site-packages\django\template\defaulttags.py" in render
281. return nodelist.render(context)
File "D:\Docs\Work\repo\so_virtual_env\lib\site-packages\django\template\base.py" in render
823. bit = self.render_node(node, context)
File "D:\Docs\Work\repo\so_virtual_env\lib\site-packages\django\template\debug.py" in render_node
74. return node.render(context)
File "D:\Docs\Work\repo\project\model_comments\templatetags\model_comment_tags.py" in render
26. return self.func(context)
File "D:\Docs\Work\repo\project\model_comments\templatetags\model_comment_tags.py" in wrap
75. form.set_request(request)
File "D:\Docs\Work\repo\project\model_comments\forms.py" in set_request
106. self.fields['from_url'].initial = unicode(Url(request))
File "D:\Docs\Work\repo\project\model_comments\url_util.py" in __init__
11. self.scheme, self.netloc, self.path, self.params, self.query_string, self.fragment = urlparse.urlparse(url)
File "C:\Python27\Lib\urlparse.py" in urlparse
134. tuple = urlsplit(url, scheme, allow_fragments)
File "C:\Python27\Lib\urlparse.py" in urlsplit
173. i = url.find(':')
Exception Type: AttributeError at /feed/1
Exception Value: 'WSGIRequest' object has no attribute 'find'
And the error happens when a templatetag is used:
html = "{% load model_comment_tags %} \
{% get_comment_form for feed as post_form %}\
{% render_comment_form post_form %}"
t = template.Template(html)
html = t.render(RequestContext(request, {'feed': private_feed}))
I've checked all my middleware, the order of apps, deleted .pyc files, and made all sorts of experiments in the template.
There's a bug in the django_model_comments library, because here they pass the HttpRequest object, not a string which is what the Url class here is expecting, so instead it should call the build_absolute_uri() method on the request object and then pass the string to the Url class.
So basically replace
unicode(Url(request))
with
unicode(Url(request.build_absolute_uri()))
I'm getting a strange error message with [django-ratings][1]. The following is in my urls.py:
url(r'^rate/(?P<object_id>\d+)/(?P<score>\d+)/', AddRatingFromModel(),{
'app_label': 'spiceapp',
'model': 'spice',
'field_name': 'rating',
}),
If I navigate to this page: /spiceapp/rate/1/2, I get the following error:
Caught AttributeError while rendering: 'AddRatingFromModel' object has no attribute 'name'
What would cause this to happen?
Environment:
Request Method: GET
Request URL: http://localhost:8000/spiceapp/rate/1/2/
Django Version: 1.3.1
Python Version: 2.7.2
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.humanize',
'django.contrib.markup',
'mptt',
'treenav',
'djangoratings',
'django.contrib.databrowse',
'pinax.templatetags',
'django_facebook',
'aiteo',
'haystack',
'notification',
'staticfiles',
'debug_toolbar',
'mailer',
'uni_form',
'crispy_forms',
'django_openid',
'ajax_validation',
'timezones',
'emailconfirmation',
'announcements',
'pagination',
'friends',
'messages',
'oembed',
'groups',
'threadedcomments',
'wakawaka',
'swaps',
'tagging',
'bookmarks',
'photologue',
'avatar',
'flag',
'microblogging',
'locations',
'django_sorting',
'tagging_ext',
'smuggler',
'voting',
'pinax.apps.signup_codes',
'pinax.apps.analytics',
'pinax.apps.blog',
'pinax.apps.tribes',
'pinax.apps.photos',
'pinax.apps.topics',
'pinax.apps.threadedcomments_extras',
'about',
'account',
'waitinglist',
'spiceapp',
'bbauth',
'profiles']
Installed Middleware:
['django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django_openid.consumer.SessionConsumer',
'django.contrib.messages.middleware.MessageMiddleware',
'groups.middleware.GroupAwareMiddleware',
'pinax.apps.account.middleware.AuthenticatedMiddleware',
'pinax.apps.account.middleware.LocaleMiddleware',
'django.middleware.doc.XViewMiddleware',
'pagination.middleware.PaginationMiddleware',
'django_sorting.middleware.SortingMiddleware',
'pinax.middleware.security.HideSensistiveFieldsMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware']
Template error:
In template /Users/nb/Desktop/myenv2/lib/python2.7/site-packages/debug_toolbar/templates/debug_toolbar/base.html, error at line 48
Caught AttributeError while rendering: 'AddRatingFromModel' object has no attribute '__name__'
38 : </div>
39 : {% for panel in panels %}
40 : {% if panel.has_content %}
41 : <div id="{{ panel.dom_id }}" class="panelContent">
42 : <div class="djDebugPanelTitle">
43 : {% trans "Close" %}
44 : <h3>{{ panel.title|safe }}</h3>
45 : </div>
46 : <div class="djDebugPanelContent">
47 : <div class="scroll">
48 : {{ panel.content|safe }}
49 : </div>
50 : </div>
51 : </div>
52 : {% endif %}
53 : {% endfor %}
54 : <div id="djDebugWindow" class="panelContent"></div>
55 : </div>
56 :
Traceback:
File "/Users/nb/Desktop/myenv2/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
178. response = middleware_method(request, response)
File "/Users/nb/Desktop/myenv2/lib/python2.7/site-packages/debug_toolbar/middleware.py" in process_response
104. smart_unicode(self.debug_toolbars[request].render_toolbar() + self.tag))
File "/Users/nb/Desktop/myenv2/lib/python2.7/site-packages/debug_toolbar/toolbar/loader.py" in render_toolbar
78. return render_to_string('debug_toolbar/base.html', context)
File "/Users/nb/Desktop/myenv2/lib/python2.7/site-packages/django/template/loader.py" in render_to_string
183. return t.render(Context(dictionary))
File "/Users/nb/Desktop/myenv2/lib/python2.7/site-packages/django/test/utils.py" in instrumented_test_render
60. return self.nodelist.render(context)
File "/Users/nb/Desktop/myenv2/lib/python2.7/site-packages/django/template/base.py" in render
744. bits.append(self.render_node(node, context))
File "/Users/nb/Desktop/myenv2/lib/python2.7/site-packages/django/template/debug.py" in render_node
73. result = node.render(context)
File "/Users/nb/Desktop/myenv2/lib/python2.7/site-packages/django/template/defaulttags.py" in render
227. nodelist.append(node.render(context))
File "/Users/nb/Desktop/myenv2/lib/python2.7/site-packages/django/template/defaulttags.py" in render
311. return self.nodelist_true.render(context)
File "/Users/nb/Desktop/myenv2/lib/python2.7/site-packages/django/template/base.py" in render
744. bits.append(self.render_node(node, context))
File "/Users/nb/Desktop/myenv2/lib/python2.7/site-packages/django/template/debug.py" in render_node
73. result = node.render(context)
File "/Users/nb/Desktop/myenv2/lib/python2.7/site-packages/django/template/debug.py" in render
90. output = self.filter_expression.resolve(context)
File "/Users/nb/Desktop/myenv2/lib/python2.7/site-packages/django/template/base.py" in resolve
510. obj = self.var.resolve(context)
File "/Users/nb/Desktop/myenv2/lib/python2.7/site-packages/django/template/base.py" in resolve
653. value = self._resolve_lookup(context)
File "/Users/nb/Desktop/myenv2/lib/python2.7/site-packages/django/template/base.py" in _resolve_lookup
698. current = current()
File "/Users/nb/Desktop/myenv2/lib/python2.7/site-packages/debug_toolbar/panels/request_vars.py" in content
35. 'view_func': '%s.%s' % (self.view_func.__module__, self.view_func.__name__),
Exception Type: TemplateSyntaxError at /spiceapp/rate/1/2/
Exception Value: Caught AttributeError while rendering: 'AddRatingFromModel' object has no attribute '__name__'
This looks like an old bug in django-debug-toolbar. Do you happen to know which version you are using? Because the file looks like the one in this commit. Several fixes has been made to that file since then: this one, for example seems to address specifically your issue.
In any case, the version you're using seems to predate the 2nd of June, 2011. I would try looking into updating your environment.