Hi, Julian

I think this problem can already be addressed by having a single catchall
/<slug>/ URL pattern, and writing a SlugHandlerView which would try
different options  within the view code, rather than in the URL dispatching.

Then it would just be a matter or catching exceptions for your .get()
methods, and raising a final 404 in case nothing is found, which would in
turn make this a django-users sort of question from here on.

Unless I'm missing something, this behavior can be achieved with what's
already in core today.


Cheers,
AT


On Mon, Mar 18, 2013 at 12:23 PM, julianb <julian....@gmail.com> wrote:

> Hi,
>
> imagine the following use case:
>
> You build an online store where you have sorted products into several
> categories and maybe associated an occasion. Now you want to build URLs. So
> the URL schema that all of the store's owners agree on is:
>
> /<product-slug>/
> /<category-slug>/
> /<occasion-slug>/
>
> Look simple.
>
> Because product slugs should generally be different to category slugs and
> occasions, you expect no clashes here. And you don't want to bloat the URLs
> by putting product/ and category/ in there. And you also do not want to
> resort making it look cryptic by having just /p/<product-slug>/ and so on.
> Then it comes to Django. How do you do that?
>
> Well, at the moment, as far as I am aware, you can't. The first URL will
> match everything all the time, not giving the other views a chance to kick
> in.
>
> So I propose some kind of URL fallthrough. The view could do
>
> raise UrlNotMatched
>
> and the dispatcher goes to the next possible matching view.
>
> Would that be good? Any thoughts?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-developers?hl=en
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to