On 13 avr, 05: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'), > )
(snip) > Here's what my views.py looks like (continuing with random example): > from django.shortcuts import render_to_response, get_object_or_404 > from lymphoma.ldata.models import Patient, Pathology > > def index(request): > client_list = Clients.objects.all().order_by('-timestamp') > return render_to_response('shop/index.html', {'client_list': > client_list}) > > def details(request, client_id): > c = Clients.objects.get(pk=client_id) > receipt_list = c.receipts_set.all() > contacts_list = c.contacts_set.all() > return render_to_response('shop/details.html', {'client': c, > 'receipt_list': receipt_list, 'ccontact_list': contact_list}) > > def receipts(request, client_id): > c = Clients.objects.get(pk=client_id) > receipt_list = c.receipts_set.all() > contacts_list = c.contacts_set.all() > return render_to_response('shop/receipts.html', {'client': c, > 'receipt_list': receipt_list, 'ccontact_list': contact_list}) > > def receipts(request, client_id): > c = Clients.objects.get(pk=client_id) > receipt_list = c.receipts_set.all() > contacts_list = c.contacts_set.all() > return render_to_response('shop/contacts.html', {'client': c, > 'receipt_list': receipt_list, 'ccontact_list': contact_list}) > > Note that all I change in these views is the template. > > So, what am I doing wrong here? What I currently have works, but I'm > sure I'm not proceeding properly. Pass the template as extra_context from your urls. There are some examples in the generic views. > Any help would be much appreciated. Thank you in advance. > > Cheers, > Ricardo -- 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.