Reputation: 11
I can't make url.py
. It still shows page not found.
These are my urls:
/pins/tag/?search=A/
/pins/tag/?search=B/
/pins/tag/?search=C/
A,B,C
are variable strings.
This is my urls.py
:
url(r'^pins/tag/?search=(?P<tag>(\w|-)+)/$')
How do I make a correct urls.py
?
Upvotes: 0
Views: 196
Reputation: 1631
Regex like this would match anything except newline character (.*)
. So your URL should look something like this. If you just want Uppercase alphabets stick to [A-Z]
url(r'^pins/tag/?search=(?P<tag>.+)/$', views.search_tag , name='search_tag'),
views.py
def search_tag(request, tag):
#do whatever here with tag
Upvotes: 1
Reputation: 1
I mapping the url like this in my projects
url(r'^pins/tags/(?P[\w.@+-]+)/$', 'what_app_search', name='search')
Give me a feel back if it resolve the mapping.
Upvotes: 0