On Sunday, 18 February 2018 16:19:31 UTC, Henrik Baran wrote:
>
> Hi,
>
> I face a very weird phenomenon. I have following two urls established: 
>
> url(r'types/$', views.types, name='types'),
> url(r'box_types/$', views.box_types, name='box types')
>
>
> If I load "/types/" the view "types" is shown, all ok. In case I load 
> "/box_types" unexpectedly also "types" is shown. However, I expect 
> "box_types" to load. How is this possible? I tested with some other urls 
> and it seem like in case a url string is a sub-string of another url, it 
> always loads the sub-string url. 
>
> Is this a feature I am not aware of or are we looking on a bug?
>
> Thanks for reply and best regards,
> Henrik
>


There is a bug, but it is in your regexes. You need to anchor the pattern 
to the start of the string: 

url(r'^types/$', views.types, name='types'),
url(r'^box_types/$', views.box_types, name='box types')

--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e31b2082-9b80-49a2-a8d4-c3007b155f48%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to