On Tue, Mar 19, 2013 at 12:26 PM, Felipe Prenholato
<[email protected]> wrote:
> Hi Julian. My 2 cents.
>
> What you want is:
>
> urlpatterns = patterns('',
>     url_fallthrought(r'^(?P<slug>[-\w]+)$',
>         views=[(ProductView.as_view(),
>                    CategorView.as_view(),
>                    OccasionView.as_view())], name="my_super_url"),)

def view_chain(views):
    def inner(*args, **kwargs):
        for view in views:
            try:
                return view(*args, **kwargs)
            except Http404:
                pass
        raise Http404
    return inner

urlpatterns = patterns('',
    (r'^(?P<slug>[-\w]+)$',
     view_chain([ProductView.as_view(),
                 CategoryView.as_view(),
                 OccasionView.as_view()]), name="my_super_url"),
)

-- 
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 [email protected].
To post to this group, send email to [email protected].
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