Reputation: 1063
I have a django url shown below :
url(r'^update_status/field1/(?P<field1_id>.*)/field2/(?P<field2_id>.*)/$', 'update_status', name='update_status')
This catches both the urls like :
update_status/field1/0445df4d8e1c43ae9/field2/f12b6b5c98/mraid.js/
and
update_status/field1/0445df4d8e1c43ae9/field2/f12b6b5c98
I want to capture only the second url . What should be changed in the django url?
Upvotes: 0
Views: 57
Reputation: 20702
Your regular expression (?P<field_id>.*)
catches any character, including /
characters. You want to restrict it to the format of the field_id
s like this: (?P<field1_id>[0-9a-f]+)
(same for field2_id).
Note: I'm assuming your id consists only of hexadecimal characters.
Upvotes: 2