def poll(request, poll_id): # This 3 line combination could use a shortcut like get_object_or_404 p = Poll.get_by_id(int(poll_id)) if p is None: raise Http404 choices = Choice.query(Choice.poll == p.key).fetch() return render_to_response( 'poll.html', { 'poll': p, 'choices': choices, } )