Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Oct. 10, 2007 22:27:40

k.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

dict objects are unhashable


Can someone help me with the following error. It occurs when I restart
Apache and try to load the Admin page. When I refresh, the Admin page
comes up, however the Documentation, Change Password, and Log Out
links callhttp://localhost/admin/. I reinstalled Django, but it did
not help.


TypeError at /admin/
dict objects are unhashable
Request Method: GET
Request URL:http://localhost/admin/Exception Type: TypeError
Exception Value: dict objects are unhashable
Exception Location: C:\Python25\lib\site-packages\django\core
\urlresolvers.py in _get_reverse_dict, line 222
Python Executable: C:\wamp\apache2\bin\httpd.exe
Python Version: 2.5.1
Template error

In template c:\python25\lib\site-packages\django\contrib\admin
\templates\admin\base.html, error at line 28
Caught an exception while rendering: dict objects are unhashable
18 {% if not is_popup %}
19 <!-- Header -->
20 <div id="header">
21 <div id="branding">
22 {% block branding %}{% endblock %}
23 </div>
24 {% if user.is_authenticated and user.is_staff %}
25 <div id="user-tools">
26 {% trans 'Welcome,' %} <strong>{% if user.first_name %}
{{ user.first_name|escape }}{% else %}{{ user.username }}{% endif %}</
strong>.
27 {% block userlinks %}
28 <a href="{% url django.contrib.admin.views.doc.doc_index %}">{%
trans 'Documentation' %}</a>
29 / <a href="{% url django.contrib.auth.views.password_change %}">{%
trans 'Change password' %}</a>
30 / <a href="{% url django.contrib.auth.views.logout %}">{% trans
'Log out' %}</a>
31 {% endblock %}
32 </div>
33 {% endif %}
34 {% block nav-global %}{% endblock %}
35 </div>
36 <!-- END Header -->
37 {% block breadcrumbs %}<div class="breadcrumbs"><a href="/">{%
trans 'Home' %}</a>{% if title %} &rsaquo; {{ title|escape }}{% endif
%}</div>{% endblock %}
38 {% endif %}
Traceback (innermost last)
Switch to copy-and-paste view

* C:\Python25\lib\site-packages\django\template\__init__.py in
render_node
803.
804. def render_node(self, node, context):
805. return node.render(context)
806.
807. class DebugNodeList(NodeList):
808. def render_node(self, node, context):
809. try:
810. result = node.render(context) ...
811. except TemplateSyntaxError, e:
812. if not hasattr(e, 'source'):
813. e.source = node.source
814. raise
815. except Exception, e:
816. from sys import exc_info
▶ Local vars
Variable Value
context
[{'block': <Block Node: userlinks. Contents: >}, {'title': u'Site
administration'}, {'MEDIA_URL': 'http://10.1.2.214:81/'},
{'LANGUAGES': (('ar', 'Arabic'), ('bn', 'Bengali'), ('bg',
'Bulgarian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'),
('da', 'Danish'), ('de', 'German'), ('el', 'Greek'), ('en',
'English'), ('es', 'Spanish'), ('es_AR', 'Argentinean Spanish'),
('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('ga',
'Gaeilge'), ('gl', 'Galician'), ('hu', 'Hungarian'), ('he', 'Hebrew'),
('hr', 'Croatian'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja',
'Japanese'), ('ko', 'Korean'), ('km', 'Khmer'), ('kn', 'Kannada'),
('lv', 'Latvian'), ('mk', 'Macedonian'), ('nl', 'Dutch'), ('no',
'Norwegian'), ('pl', 'Polish'), ('pt', 'Portugese'), ('pt-br',
'Brazilian'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'),
('sl', 'Slovenian'), ('sr', 'Serbian'), ('sv', 'Swedish'), ('ta',
'Tamil'), ('te', 'Telugu'), ('tr', 'Turkish'), ('uk', 'Ukrainian'),
('zh-cn', 'Simplified Chinese'), ('zh-tw', 'Traditional Chinese')),
'LANGUAGE_BIDI': False, 'LANGUAGE_CODE': 'en-us'}, {}, {'perms':
<django.core.context_processors.PermWrapper object at 0x062C9350>,
'messages': , 'user': <User: ksilha>}, {}]
e
TypeError('dict objects are unhashable',)
exc_info
<built-in function exc_info>
node
<django.template.defaulttags.URLNode object at 0x062F1BD0>
self

wrapped
TemplateSyntaxError('Caught an exception while rendering: dict
objects are unhashable',)
* C:\Python25\lib\site-packages\django\template\defaulttags.py in
render
337. self.kwargs = kwargs
338.
339. def render(self, context):
340. from django.core.urlresolvers import reverse,
NoReverseMatch
341. args =
342. kwargs = dict()
343. try:
344. return reverse(self.view_name, args=args,
kwargs=kwargs) ...
345. except NoReverseMatch:
346. try:
347. project_name = settings.SETTINGS_MODULE.split('.')
348. return reverse(project_name + '.' + self.view_name,
args=args, kwargs=kwargs)
349. except NoReverseMatch:
350. return ''
▶ Local vars
Variable Value
NoReverseMatch
<class 'django.core.urlresolvers.NoReverseMatch'>
args

context
[{'block': <Block Node: userlinks. Contents: >}, {'title': u'Site
administration'}, {'MEDIA_URL': 'http://10.1.2.214:81/'},
{'LANGUAGES': (('ar', 'Arabic'), ('bn', 'Bengali'), ('bg',
'Bulgarian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'),
('da', 'Danish'), ('de', 'German'), ('el', 'Greek'), ('en',
'English'), ('es', 'Spanish'), ('es_AR', 'Argentinean Spanish'),
('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('ga',
'Gaeilge'), ('gl', 'Galician'), ('hu', 'Hungarian'), ('he', 'Hebrew'),
('hr', 'Croatian'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja',
'Japanese'), ('ko', 'Korean'), ('km', 'Khmer'), ('kn', 'Kannada'),
('lv', 'Latvian'), ('mk', 'Macedonian'), ('nl', 'Dutch'), ('no',
'Norwegian'), ('pl', 'Polish'), ('pt', 'Portugese'), ('pt-br',
'Brazilian'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'),
('sl', 'Slovenian'), ('sr', 'Serbian'), ('sv', 'Swedish'), ('ta',
'Tamil'), ('te', 'Telugu'), ('tr', 'Turkish'), ('uk', 'Ukrainian'),
('zh-cn', 'Simplified Chinese'), ('zh-tw', 'Traditional Chinese')),
'LANGUAGE_BIDI': False, 'LANGUAGE_CODE': 'en-us'}, {}, {'perms':
<django.core.context_processors.PermWrapper object at 0x062C9350>,
'messages': , 'user': <User: ksilha>}, {}]
kwargs
{}
reverse
<function reverse at 0x05D15AB0>
self
<django.template.defaulttags.URLNode object at 0x062F1BD0>
* C:\Python25\lib\site-packages\django\core\urlresolvers.py in
reverse
289.
290. def resolve(path, urlconf=None):
291. return get_resolver(urlconf).resolve(path)
292.
293. def reverse(viewname, urlconf=None, args=None,
kwargs=None):
294. args = args or
295. kwargs = kwargs or {}
296. return iri_to_uri(u'/' +
get_resolver(urlconf).reverse(viewname, *args, **kwargs)) ...
297.
▶ Local vars
Variable Value
args

kwargs
{}
urlconf
None
viewname
u'django.contrib.admin.views.doc.doc_index'
* C:\Python25\lib\site-packages\django\core\urlresolvers.py in
reverse
274. return self._resolve_special('500')
275.
276. def reverse(self, lookup_view, *args, **kwargs):
277. try:
278. lookup_view = get_callable(lookup_view, True)
279. except (ImportError, AttributeError):
280. raise NoReverseMatch
281. if lookup_view in self.reverse_dict: ...
282. return u''.join([reverse_helper(part.regex, *args,
**kwargs) for part in self.reverse_dict])
283. raise NoReverseMatch
284.
285. def reverse_helper(self, lookup_view, *args, **kwargs):
286. sub_match = self.reverse(lookup_view, *args, **kwargs)
287. result = reverse_helper(self.regex, *args, **kwargs)
▶ Local vars
Variable Value
args
()
kwargs
{}
lookup_view
<function _checklogin at 0x063048B0>
self
<RegexURLResolver positiontech2.urls ^/>
* C:\Python25\lib\site-packages\django\core\urlresolvers.py in
_get_reverse_dict
215. if not self._reverse_dict and hasattr(self.urlconf_module,
'urlpatterns'):
216. for pattern in reversed(self.urlconf_module.urlpatterns):
217. if isinstance(pattern, RegexURLResolver):
218. for key, value in pattern.reverse_dict.iteritems():
219. self._reverse_dict = (pattern,) + value
220. else:
221. self._reverse_dict = (pattern,)
222. self._reverse_dict = (pattern,) ...
223. return self._reverse_dict
224. reverse_dict = property(_get_reverse_dict)
225.
226. def resolve(self, path):
227. tried =
228. match = self.regex.search(path)
▶ Local vars


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en-~----------~----~----~----~------~----~------~--~---

Offline

#2 Oct. 10, 2007 22:41:32

Jeremy D.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

dict objects are unhashable


On 10/10/07, kevinski <> wrote:
>
> Can someone help me with the following error. It occurs when I restart
> Apache and try to load the Admin page. When I refresh, the Admin page
> comes up, however the Documentation, Change Password, and Log Out
> links callhttp://localhost/admin/. I reinstalled Django, but it did
> not help.

What locale are you using?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en-~----------~----~----~----~------~----~------~--~---

Offline

#3 Oct. 10, 2007 22:44:03

Jeremy D.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

dict objects are unhashable


On 10/10/07, kevinski <> wrote:
>
> Can someone help me with the following error. It occurs when I restart
> Apache and try to load the Admin page. When I refresh, the Admin page
> comes up, however the Documentation, Change Password, and Log Out
> links callhttp://localhost/admin/. I reinstalled Django, but it did
> not help.
....
> 215. if not self._reverse_dict and hasattr(self.urlconf_module,
> 'urlpatterns'):
> 216. for pattern in reversed(self.urlconf_module.urlpatterns):
> 217. if isinstance(pattern, RegexURLResolver):
> 218. for key, value in pattern.reverse_dict.iteritems():
> 219. self._reverse_dict = (pattern,) + value
> 220. else:
> 221. self._reverse_dict = (pattern,)
> 222. self._reverse_dict = (pattern,) ...
> 223. return self._reverse_dict
> 224. reverse_dict = property(_get_reverse_dict)
> 225.
> 226. def resolve(self, path):
> 227. tried =
> 228. match = self.regex.search(path)
> ▶ Local vars
>

Also, please expand local vars and show what the values of
self._reverse_dict and pattern.name are.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en-~----------~----~----~----~------~----~------~--~---

Offline

#4 Oct. 10, 2007 22:50:12

k.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

dict objects are unhashable


Honestly, I do not know what that means. How do I check this?

On Oct 10, 4:41 pm, "Jeremy Dunck" <> wrote:
> On 10/10/07, kevinski <> wrote:
>
>
>
> > Can someone help me with the following error. It occurs when I restart
> > Apache and try to load the Admin page. When I refresh, the Admin page
> > comes up, however the Documentation, Change Password, and Log Out
> > links callhttp://localhost/admin/. I reinstalled Django, but it did
> > not help.
>
> What locale are you using?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en-~----------~----~----~----~------~----~------~--~---

Offline

#5 Oct. 10, 2007 22:58:11

k.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

dict objects are unhashable


# C:\Python25\lib\site-packages\django\core\urlresolvers.py in
reverse

274. return self._resolve_special('500')
275.
276. def reverse(self, lookup_view, *args, **kwargs):
277. try:
278. lookup_view = get_callable(lookup_view, True)
279. except (ImportError, AttributeError):
280. raise NoReverseMatch

281. if lookup_view in self.reverse_dict: ...

282. return u''.join([reverse_helper(part.regex, *args, **kwargs) for
part in self.reverse_dict])
283. raise NoReverseMatch
284.
285. def reverse_helper(self, lookup_view, *args, **kwargs):
286. sub_match = self.reverse(lookup_view, *args, **kwargs)
287. result = reverse_helper(self.regex, *args, **kwargs)

▼ Local vars
Variable Value
args
()
kwargs
{}
lookup_view
<function _checklogin at 0x0630A870>
self
<RegexURLResolver positiontech2.urls ^/>
# C:\Python25\lib\site-packages\django\core\urlresolvers.py in
_get_reverse_dict

215. if not self._reverse_dict and hasattr(self.urlconf_module,
'urlpatterns'):
216. for pattern in reversed(self.urlconf_module.urlpatterns):
217. if isinstance(pattern, RegexURLResolver):
218. for key, value in pattern.reverse_dict.iteritems():
219. self._reverse_dict = (pattern,) + value
220. else:
221. self._reverse_dict = (pattern,)

222. self._reverse_dict = (pattern,) ...

223. return self._reverse_dict
224. reverse_dict = property(_get_reverse_dict)
225.
226. def resolve(self, path):
227. tried =
228. match = self.regex.search(path)

▼ Local vars
Variable Value
pattern
<RegexURLPattern {'template_name': 'task_form.html'} ^timemgt/edit/(?
P<object_id>\d+)/$>
self
<RegexURLResolver positiontech2.urls ^/>

On Oct 10, 4:43 pm, "Jeremy Dunck" <> wrote:
> On 10/10/07, kevinski <> wrote:
>
>
>
>
>
>
>
> > Can someone help me with the following error. It occurs when I restart
> > Apache and try to load the Admin page. When I refresh, the Admin page
> > comes up, however the Documentation, Change Password, and Log Out
> > links callhttp://localhost/admin/. I reinstalled Django, but it did
> > not help.
> ....
> >        215. if not self._reverse_dict and hasattr(self.urlconf_module,
> > 'urlpatterns'):
> >        216. for pattern in reversed(self.urlconf_module.urlpatterns):
> >        217. if isinstance(pattern, RegexURLResolver):
> >        218. for key, value in pattern.reverse_dict.iteritems():
> >        219. self._reverse_dict = (pattern,) + value
> >        220. else:
> >        221. self._reverse_dict = (pattern,)
> >        222. self._reverse_dict = (pattern,) ...
> >        223. return self._reverse_dict
> >        224. reverse_dict = property(_get_reverse_dict)
> >        225.
> >        226. def resolve(self, path):
> >        227. tried =
> >        228. match = self.regex.search(path)
> >       ▶ Local vars
>
> Also, please expand local vars and show what the values of
> self._reverse_dict and pattern.name are.- Hide quoted text -
>
> - Show quoted text -


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en-~----------~----~----~----~------~----~------~--~---

Offline

#6 Oct. 10, 2007 23:18:11

Jeremy D.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

dict objects are unhashable


On 10/10/07, kevinski <> wrote:
>
> Honestly, I do not know what that means. How do I check this?

Apologies-- I assumed that the problem had something to do with
unicode and localization.http://www.djangoproject.com/documentation/i18n/#if-you-don-t-need-internationalization-in-your-appI now see the problem doesn't have anything to do with that. The
problem appears to be with your urlconf. Specifically, it appears
that you're providing a dictionary rather than a string for the name
parameter (the 4th parameter to an urlpatterns tuple).

If you have trouble identifying which one, please include the code
from positiontech2.urls so I can point out the problem.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en-~----------~----~----~----~------~----~------~--~---

Offline

#7 Oct. 11, 2007 14:25:29

k.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

dict objects are unhashable


You were right the problem was in the urls. Thank you so much for your
help!


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en-~----------~----~----~----~------~----~------~--~---

Offline

#8 Dec. 2, 2010 14:18:43

Carlos A.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

dict objects are unhashable


Hi guys (and gals),
Why I am getting this error?

Caught TypeError while rendering: dict objects are unhashable

I am using a generic view (object_list) to render my template. But I
guess I am not passing all the data correctly.
Could you show me the correct direction?

my urls:
info_dict = {
'queryset': Obra.objects.all(),
'template_object_name': 'obras',
'paginate_by': 5,
}
(r'page(?P<page>+)/$',
'django.views.generic.list_detail.object_list', info_dict,
dict(template_name='obras/obra_list.html')),
)

template:
<div id="main">
{% for obra in obras_list %}
<div class="post">
<div class="meta">
<h2>Obra: {{ obra.numero }}</h2>


thanks folks
Aboim

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#9 Dec. 2, 2010 14:25:25

Tom E.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

dict objects are unhashable


On Thu, Dec 2, 2010 at 2:18 PM, Carlos Aboim <abo...@gmail.com> wrote:
> Hi guys (and gals),
> Why I am getting this error?
>
> Caught TypeError while rendering: dict objects are unhashable
>
> I am using a generic view (object_list) to render my template. But I
> guess I am not passing all the data correctly.
> Could you show me the correct direction?
>
> my urls:
> info_dict = {
>    'queryset': Obra.objects.all(),
>    'template_object_name': 'obras',
>    'paginate_by': 5,
>    }
> (r'page(?P<page>+)/$',
> 'django.views.generic.list_detail.object_list', info_dict,
> dict(template_name='obras/obra_list.html')),
>    )http://docs.djangoproject.com/en/1.2/topics/http/urls/#patterns"""
The first argument to patterns() is a string prefix. See The view prefix below.

The remaining arguments should be tuples in this format:

(regular expression, Python callback function [, optional dictionary
])
"""

I doubt dict(template_name='obras/obra_list.html') is appropriate as a name.

Cheers

Tom

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#10 Dec. 2, 2010 14:42:24

Carlos A.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

dict objects are unhashable


Yeah I understand you!

but is something missing me, because if I put it this way

my urls:
info_dict = {
'queryset': Obra.objects.all(),
'template_object_name': 'obras',
'paginate_by': 5,
'tamplate_name': 'obras/obra_list.html',
}
(r'page(?P<page>+)/$',
'django.views.generic.list_detail.object_list', info_dict),

the problem is the same!

but the first form was more usefull to me because I want the other
generic views tha I will be using catch diferent templates (...name)

I was think on use a wrap function on views.py, but I think this is a
simple problem

I just don't get it, can you help me?

thanks
Aboim


On Dec 2, 2:23 pm, Tom Evans <tevans...@googlemail.com> wrote:
> On Thu, Dec 2, 2010 at 2:18 PM, Carlos Aboim <abo...@gmail.com> wrote:
> > Hi guys (and gals),
> > Why I am getting this error?
>
> > Caught TypeError while rendering: dict objects are unhashable
>
> > I am using a generic view (object_list) to render my template. But I
> > guess I am not passing all the data correctly.
> > Could you show me the correct direction?
>
> > my urls:
> > info_dict = {
> >    'queryset': Obra.objects.all(),
> >    'template_object_name': 'obras',
> >    'paginate_by': 5,
> >    }
> > (r'page(?P<page>+)/$',
> > 'django.views.generic.list_detail.object_list', info_dict,
> > dict(template_name='obras/obra_list.html')),
> >    )
>
>http://docs.djangoproject.com/en/1.2/topics/http/urls/#patterns>
> """
> The first argument to patterns() is a string prefix. See The view prefix
> below.
>
> The remaining arguments should be tuples in this format:
>
> (regular expression, Python callback function [, optional dictionary
> ])
> """
>
> I doubt dict(template_name='obras/obra_list.html') is appropriate as a name.
>
> Cheers
>
> Tom

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 23rd of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support