Reputation: 2290
I have my URL defined as follows:
(r'^article/edit/(.*)/$', 'mysite.views.edit_article')
And the function defined as:
def edit_article(request, article_id):
However, it seems that any request to this page results in the wrong value being passed in for article_id. If I redefine my URL as
(r'^article/(.*)/$', 'mysite.views.edit_article')
Minus the "edit/" it seems to work. Any suggestions on how to fix this?
Upvotes: 2
Views: 130
Reputation: 10109
Try this:
url (r'^article/edit/(?P<article_id>\d+)$', 'mysite.views.edit_article'),
Take a look at the Named Groups in the Django documentation
Upvotes: 3