On Fri, Feb 26, 2016 at 6:38 PM, Malik Rumi <malik.a.r...@gmail.com> wrote:

> *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. "
>
>
SingleObjectMixin looks for URL kwargs named 'pk' or 'slug' by default.
There's been a fair bit of cross-talk about which URL's are actually the
problem, but you only have one that would work for the view you are trying
to call: url(r'^code/(?P<slug>[\w-]+)/$', CodeDetailView.as_view(),
name='family'),

At this point I can't tell which URL you are talking about, so I don't know
if you are executing/matching the right one. The error would indicate that
you are matching just r'code/' without the (?P<slug>), so the view has no
way to look up the correct object to return.

-James

-- 
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+unsubscr...@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/CA%2Be%2BciX4s_nfs7DqbMRwtyprqM%3D7NkaGKXA1i59-Hq37WiE7Ug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to