Amarendra Reddy
Amarendra Reddy

Reputation: 243

Django Url not resolving when passing query parameters

project urls.py:

url(r'^landlord/',include('Landlord.urls',namespace="landlord")),

landlord app urls.py:

 url(r'^edit/$', views.edit_property, name="edit_property"),
    url(r'^edit/(?P<id>[-\w]+)/$', views.edit_property_form, name="edit_property_form"),

The url written in the browser is "landlord/edit/?id=1". But it is resolving to first url only.

Upvotes: 0

Views: 79

Answers (1)

Alex Hall
Alex Hall

Reputation: 36033

/(?P<id>[-\w]+)/ is not a query parameter, it's part of the main URL. It's expecting a URL like landlord/edit/1/.

Upvotes: 3

Related Questions