Friday, February 26, 2016

Re: errors while trying to add extra context (detailview, __getitem__)

And here is the code from the original error:

#!/usr/bin/python
# -*- coding: utf-8 -*-
from django.conf.urls import include, url, patterns
from . import views
from django.views.generic.base import TemplateView
from essell.models import Code
from essell.views import CodeListViewAll
#from essell.views import CodeDetailView
from essell.views import CodeDetail


urlpatterns = patterns(['',
    url(r'^$', TemplateView.as_view(template_name='library.html')),
    url(r'code/', CodeDetail.as_view(template_name='code_family_detail')),
    url(r'^constitution', CodeListViewAll.as_view(), name='constitution'), 
    # this is the one that got the error)
    url(r'^code/(?P<slug>[\w-]+)/$', CodeDetailView.as_view(), name='family'),
])

'''
for convenience sake, here is the error again:
 File "/home/malikarumi/Projects/cannon/jamf/essell/urls.py", line 23, in <module>
    url(r'^code/(?P<slug>[\w-]+)/$', CodeDetailView.as_view(), name='family'),
TypeError: 'function' object has no attribute '__getitem__'
'''

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/bb240c98-70b3-49af-84ea-7541958f78d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment