Thanks! I knew there was a way around this. Repeating code is very not
like django :)

Works like a charm.

Thanks again.

On Apr 13, 12:30 am, Danny Adair <danny.ad...@unfold.co.nz> wrote:
> On Tue, Apr 13, 2010 at 15:59, rvidal <rvi...@gmail.com> wrote:
> >[...]
> > I have my urls.py looking something like this:
> > urlpatterns = patterns('mysites.shop.views',
> >        (r'^$', 'index'),
> >        (r'^client/(?P<client_id>\d+)/$', 'details'),
> >        (r'^client/(?P<client_id>\d+)/receipts/$', 'receipts'),
> >        (r'^client/(?P<client_id>\d+)/contacts/$', 'contacts'),
> > )
>
> You could just pass an additional parameter:
> ===========================================
>         (r'^client/(?P<client_id>\d+)/$', 'myview', {'template_name':
> 'details'}),
>         (r'^client/(?P<client_id>\d+)/receipts/$', 'myview',
> {'template_name': 'receipts'}),
>         (r'^client/(?P<client_id>\d+)/contacts/$', 'myview',
> {'template_name': 'contacts'}),
> ===========================================
> def myview(request, client_id, template_name):
> ===========================================
> Seehttp://docs.djangoproject.com/en/dev/topics/http/urls/#passing-extra-...
>
> Or let myview figure out the template from the request path.
>
> Cheers,
> Danny

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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