Fantastic solution, thank you so much. I will be sure to loose those 
phrases from my vocab as well :)

On Monday, August 27, 2012 3:18:52 AM UTC-4, Melvyn Sopacua wrote:
>
> On 27-8-2012 4:14, Matthew Meyer wrote: 
>
> > So the question: Is there a way I can keep the flexible tag regex 
> redirect 
> > behavior but then "break" from it once I reach a product page? One 
> > important thing to note is that I want to keep the product page within 
> the 
> > built up url scheme like: mens/shirts/buttonups/shirt-product/ 
>
> The first thing to note is that you need to get "redirect" and "break 
> out" out of your vocabulary. While Django's urlconfs look and walk like 
> rewrite engines, they are not rewrite engines. The primary difference is 
> that matches are handled in order and the first match wins, so there is 
> no "break out" principle. 
> Since a slug and a tag in your matches consist of identical character 
> classes there is no way to differentiate between one or the other. The 
> easy solution and one that is in line with the semantics of URLs is to 
> drop the trailing slash for the product. 
> "Back in the day" trailing slashes meant "directory listings" and no 
> trailing slash referred to "document requests" and this applies to your 
> scheme also. So your product url becomes: 
> url(r'^(?P<tag>.+)/(?P<slug>[-\w]+)$', 'product_page'), 
> -- 
> Melvyn Sopacua 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/FiWEJMZ7PHoJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to