Need help upgrading old view/url to new syntax...
Hello,
I am in the process of upgrading this "old" functional code:
urls_old.py:
<https://gist.github.com/1356108#file_urls_old.py>
views_old.py:
<https://gist.github.com/1356108#file_views_old.py>
Here's what I have so far:
urls.py:
<https://gist.github.com/1356108#file_urls.py>
views.py:
<https://gist.github.com/1356108#file_views.py>
---------
I just have a few questions:
1.
How can I access kwargs from the URL?
When I try self.kwargs['username'] I get this error:
"Generic detail view UserDetail must be called with either an object
pk or a slug."
2.
All I want to do is pass "user" and "profile" to my template...
Looking at my class-based view/url, am I going about this right (other
than the error)?
As it stands now, my "new" code seems kinda convoluted; having to say
"self.profile" and then call get_context_data just to pass "profile"
seems like a lot of extra work when compared to the older
function-based view.
---------
Any tips ya'll could provide would be extremely helpful! :)
Thanks in advance!
Cheers,
M
--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home