0

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.

5
  • Resolves to views.edit_property only even though parameter is passed Commented May 21, 2016 at 16:09
  • If you're using a form, don't put the values in the URL anyway. Get them from the request body. Commented May 21, 2016 at 16:13
  • I am asking the user if needs to edit it. If he clicks edit then i am redirecting to a page with the id he wants to edit. So i want to pass id as a query parameter. Commented May 21, 2016 at 16:24
  • In that case I would link them to the page landlord/edit/1/. Commented May 21, 2016 at 16:26
  • Thanks @AlexHall i will use that. Commented May 21, 2016 at 19:12

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.