Friday, February 26, 2016

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

OK, so maybe....MAYBE I've got this figured out. The problem is here:

https://docs.djangoproject.com/en/1.9/ref/urls/#django.conf.urls.url


I knew this, but note the examples still use the parens()


https://docs.djangoproject.com/en/1.9/ref/urls/#patterns


but that's what patterns is. It is a function. So it should have the parens. The problem is not the parens, but patterns() itself.


HOWEVER, I still have issues, if there are any night owls or people on the other side of the world who can help:

error msg:
Generic detail view CodeDetail must be called with either an object pk or a slug.
but I copied this straight out of the docs! All I did was changed the app names! See https://docs.djangoproject.com/en/1.9/topics/class-based-views/mixins/ 

"We'll rely on the default implementation of get_object() to fetch the correct Publisher object. However, we need to explicitly pass a queryset argument because otherwise the default implementation of get_object() would call get_queryset() which we have overridden to return Book objects instead of Publisher ones. " 

--
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/2a1d55e5-4b7e-4a53-ba71-7e95bbbf0657%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment