django-openid-auth: TemplateSyntaxError - django

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

Related

Reverse for 'login' not found. 'login' is not a valid view function or pattern name error no matter what url I try to visit

I am trying to reuse an account app(manages signup/login/registration using class-based views) I created in one project, in another project.
account/urls.py:
from django.urls import path
from django.contrib.auth import views as auth_views
app_name = 'account'
urlpatterns = [
path('login/', auth_views.LoginView.as_view(), name = 'login'),
path('logout/', auth_views.LogoutView.as_view(), name = 'logout'),
path('password_change/', auth_views.PasswordChangeView.as_view(), name = 'password_change'),
path('password_change/done/', auth_views.PasswordChangeDoneView.as_view(), name = 'password_change_done'),
# reset password urls:
path('password_reset/', auth_views.PasswordResetView.as_view(), name = 'password_reset'),
path('password_reset/done', auth_views.PasswordResetDoneView.as_view(), name = 'password_reset_done'),
path('reset/<uidb64>/<token>/', auth_views.PasswordResetConfirmView.as_view(), name = 'password_reset_confirm'),
path('reset/done/', auth_views.PasswordResetCompleteView.as_view(), name = 'password_reset_complete'),
]
If I try to access any of those URLs, the error will be the following:
NoReverseMatch at /account/<url>/
Reverse for 'login' not found. 'login' is not a valid view function or pattern name.
In template /Users/justinobrien/Desktop/recipeSite/website/templates/base.html, error at line 12
The only line that changes is the NoReverseMatch at /account/<url>/.
I do not mention the login view in my very primitive base.html, so I am not sure where that is coming from (file at project_root/templates/base.html):
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Website</title>
{% block head %}
{% endblock %}
</head>
<body>
{% block content %}
{% endblock %}
</body>
</html>
Other files I think may be important:
project_root/urls.py:
from django.conf.urls import url
from django.urls import path, include
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
# user account related urls:
path('account/', include('account.urls')),
]
and somethings I added to settings.py:
changed DIRS in the TEMPLATES variable, so that Django could find my base.html file
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
and I also added:
LOGIN_URL = 'login'
LOGOUT_URL = 'logout'
I was trying to reuse this functionality as it was working in a previous project, but I feel like I am missing a step somewhere. Any help is much appreciated.
edit: I realized there is also a host of account template files that this error could possibly be coming from?
Full stack trace error:
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/account/logout/
Django Version: 3.0.6
Python Version: 3.6.1
Installed Applications:
['account.apps.AccountConfig',
'crispy_forms',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles']
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']
Template error:
In template /Users/justinobrien/Desktop/recipeSite/website/templates/base.html, error at line 0
Reverse for 'login' not found. 'login' is not a valid view function or pattern name.
1 :
2 : {% load static %}
3 : <!DOCTYPE html>
4 : <html lang="en">
5 :
6 : <head>
7 : <title>Website</title>
8 :
9 :
10 : {% block head %}
Traceback (most recent call last):
File "/Users/justinobrien/Desktop/recipeSite/env/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/Users/justinobrien/Desktop/recipeSite/env/lib/python3.6/site-packages/django/core/handlers/base.py", line 145, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/Users/justinobrien/Desktop/recipeSite/env/lib/python3.6/site-packages/django/core/handlers/base.py", line 143, in _get_response
response = response.render()
File "/Users/justinobrien/Desktop/recipeSite/env/lib/python3.6/site-packages/django/template/response.py", line 105, in render
self.content = self.rendered_content
File "/Users/justinobrien/Desktop/recipeSite/env/lib/python3.6/site-packages/django/template/response.py", line 83, in rendered_content
return template.render(context, self._request)
File "/Users/justinobrien/Desktop/recipeSite/env/lib/python3.6/site-packages/django/template/backends/django.py", line 61, in render
return self.template.render(context)
File "/Users/justinobrien/Desktop/recipeSite/env/lib/python3.6/site-packages/django/template/base.py", line 171, in render
return self._render(context)
File "/Users/justinobrien/Desktop/recipeSite/env/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
return self.nodelist.render(context)
File "/Users/justinobrien/Desktop/recipeSite/env/lib/python3.6/site-packages/django/template/base.py", line 936, in render
bit = node.render_annotated(context)
File "/Users/justinobrien/Desktop/recipeSite/env/lib/python3.6/site-packages/django/template/base.py", line 903, in render_annotated
return self.render(context)
File "/Users/justinobrien/Desktop/recipeSite/env/lib/python3.6/site-packages/django/template/loader_tags.py", line 150, in render
return compiled_parent._render(context)
File "/Users/justinobrien/Desktop/recipeSite/env/lib/python3.6/site-packages/django/template/base.py", line 163, in _render
return self.nodelist.render(context)
File "/Users/justinobrien/Desktop/recipeSite/env/lib/python3.6/site-packages/django/template/base.py", line 936, in render
bit = node.render_annotated(context)
File "/Users/justinobrien/Desktop/recipeSite/env/lib/python3.6/site-packages/django/template/base.py", line 903, in render_annotated
return self.render(context)
File "/Users/justinobrien/Desktop/recipeSite/env/lib/python3.6/site-packages/django/template/loader_tags.py", line 62, in render
result = block.nodelist.render(context)
File "/Users/justinobrien/Desktop/recipeSite/env/lib/python3.6/site-packages/django/template/base.py", line 936, in render
bit = node.render_annotated(context)
File "/Users/justinobrien/Desktop/recipeSite/env/lib/python3.6/site-packages/django/template/base.py", line 903, in render_annotated
return self.render(context)
File "/Users/justinobrien/Desktop/recipeSite/env/lib/python3.6/site-packages/django/template/defaulttags.py", line 443, in render
url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
File "/Users/justinobrien/Desktop/recipeSite/env/lib/python3.6/site-packages/django/urls/base.py", line 87, in reverse
return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
File "/Users/justinobrien/Desktop/recipeSite/env/lib/python3.6/site-packages/django/urls/resolvers.py", line 677, in _reverse_with_prefix
raise NoReverseMatch(msg)
Exception Type: NoReverseMatch at /account/logout/
Exception Value: Reverse for 'login' not found. 'login' is not a valid view function or pattern name.
Save time and try to avoid changing the default location if you want to use auth_views, and that is why you see an error. The answer here is for the login form, you should remove the others logout and etc for now...
path('login/', auth_views.LoginView.as_view(), name = 'login'),
When you used path('login/',...), LoginView() gets confused since LoginView() already has a default location, have a look at the template_name in the LoginView() class
template_name = 'registration/login.html'
The default location is registration, if you want to change that you could face changing more directories...
You should add a login.html file into a new registration directory in the project templates directory, so in your case, you would have project_root/templates/registration/login.html, and then use this in the login html file as an example
<h1>Log In</h1>
<form method="POST">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">log in</button>
</form>
as_p() to display the look of the form contents. And then change LOGIN_URL = 'login' in settings.py to LOGIN_REDIRECT_URL it would look like this
LOGIN_REDIRECT_URL = 'home'
Create a home.html next to the base.html and add
{% extends 'base.html' %}
{% block content %}
<h1>home</h1>
{% if user.is_authenticated %}
Hey {{ user.username }}!
{% else %}
log in
{% endif %}
{% endblock content %}
in the project_root/urls.py, use the django’s built-in auth app
path('accounts/', include('django.contrib.auth.urls')),
More info about auth app
Import AbstractUser and create a CustomUser model in your account app
from django.contrib.auth.models import AbstractUser
from django.db import models
class CustomUser(AbstractUser):
pass
Update the settings.py file and add an AUTH_USER_MODEL config to refer to model 'account.CustomUser'
AUTH_USER_MODEL = 'account.CustomUser'

django-debug-toolbar: 'list' does not support the buffer interface

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.

WSGIRequest error using django_model_comments

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()))

Weird error message with django-ratings

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.

can I use Django comment on other pages?

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...