Reputation: 4958
I'm looking to accomplish a URL as so:
/group/<group_name>/discussion/<discussion_name>/
My implementation is shown below
url(r'^group/', include('groups.urls')
url(r'^(?P<gslug>[\w-]+)/discussion/', include('discussions.urls')),
url(r'^(?P<slug>[\w-]+)',views.discussion_detail, name='discussion_detail'))
Unfortunately in my views.discussion_detail
I do not have access to both gslug and slug. Where have I gone wrong?
def discussion_detail(request, gslug, slug):
pass //logic in here
Upvotes: 1
Views: 713
Reputation: 391
Make sure that you're passing variables into the view properly with the 'url' template tag like so
{% url 'discussion_detail' group.slug discussion.slug %}
Let me know if that works :)
Upvotes: 1