Re: models get_absolute_url issue

19 views
Skip to first unread message

Andrew Pinkham

unread,
Sep 11, 2014, 2:08:45 AM9/11/14
to django...@googlegroups.com
Hi Eddilbert,
What are the URL patterns for the two views? I suspect a problem with `pk_url_kwarg`, but I am surprised by the error output.

If that is not the problem: Does this error occur if you do not override the `form_class` of `ResourceCreateView`? Could you supply the code for `CreateResourceForm`?

Also, you may find the following site helpful when dealing with Generic Class Based Views (which allowed me to quickly check the behavior of get_object, listed in your traceback): http://ccbv.co.uk/

Andrew

Eddilbert Macharia

unread,
Sep 11, 2014, 2:55:10 AM9/11/14
to django...@googlegroups.com, m...@andrewsforge.com
Hello andrew,

Thank you for the reply, found where my problem was on my url.py i had done this

 url(r'^resource/(?P<resource>)', ResourceDetailView.as_view(), name='resource_detail'),

instead of this
 url(r'^resource/(?P<resource>\d+)', ResourceDetailView.as_view(), name='resource_detail'),

i was leaving out the \d+ in the url pattern.

Regards,
Eddilbert Macharia.

Reply all
Reply to author
Forward
0 new messages