I am trying to get the url.py to display my template based on the
'id' of my model, but I cannot get this to work, any help would be
appreciated. I have tried the url below and also my view is below, I
would like to be able to visit /admin/display//id-number and see the
ticket corresponding to that id. All i am getting is 'App not found'
(r'^admin/display/$', show_ticket),
(r'^admin/display/(\d{2})/$', show_ticket),
(r'^admin/display/(?P<id>\d+)/$', show_ticket),
(r'^admin/display/(\d+)/$', show_ticket),
(r'^admin/display/(\d+)/$', show_ticket),
)
I have tried
def show_ticket(request):
return HttpResponse("You're looking at poll")
and,
#def show_ticket(request, id):
# ticket = Ticket.objects.get(pk=id)
# return render_to_response('ticket_all.html', {'ticket':
ticket})
and,
#from django.shortcuts import render_to_response, get_object_or_404
## ...
#def show_ticket(request, id):
# p = get_object_or_404(Ticket, pk=id)
# return render_to_response('ticket_all.html', {'ticket': p})
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---