Django Error "Caught SyntaxError while rendering: invalid syntax "
Question: I'm creating an django app via this tutorial
<https://docs.djangoproject.com/en/dev/intro/tutorial04/> I'm trying to access
admin page but it display this error which I don't know how to fix.

    
    
    TemplateSyntaxError at /admin/
    Caught SyntaxError while rendering: invalid syntax (views.py, line 34)Request Method: GET 
    Request URL: http://cat.pythonanywhere.com/admin/ 
    Django Version: 1.3.5 
    Exception Type: TemplateSyntaxError 
    Exception Value: Caught SyntaxError while rendering: invalid syntax (views.py, line 34) 
    Exception Location: /home/cat/mysite/myapp/urls.py in <module>, line 2 
    Python Executable: /usr/local/bin/uwsgi 
     Python Version: 2.7.3 
    Python Path: ['/var/www',
    

my views.py are :

    
    
    from django.http import HttpResponse ,HttpResponseRedirect
    from mysite.myapp.models import Poll
    from django.http import Http404
    from django.template import Context, loader
    from django.shortcuts import render, get_object_or_404
    from django.core.urlresolvers import reverse
    from polls.models import Choice, Poll
    
    def index(request):
        return HttpResponse("Hello, world. You're at the poll index.")
    
    def detail(request, poll_id):
        return HttpResponse("You're looking at poll %s." % poll_id)
    
    def results(request, poll_id):
        return HttpResponse("You're looking at the results of poll %s." % poll_id)
    
    def vote(request, poll_id):
        p = get_object_or_404(Poll, pk=poll_id)
        try:
            selected_choice = p.choice_set.get(pk=request.POST['choice'])
        except (KeyError, Choice.DoesNotExist):
            # Redisplay the poll voting form.
            return render(request, 'myapp/detail.html', {
                'poll': p,
                'error_message': "You didn't select a choice.",
            })
        else:
            selected_choice.votes += 1
            selected_choice.save()
            # Always return an HttpResponseRedirect after successfully dealing
            # with POST data. This prevents data from being posted twice if a
            # user hits the Back button.
            return HttpResponseRedirect(reverse('myapp:results', args=(p.id,))))
    
    
    def index(request):
        latest_poll_list = Poll.objects.order_by('-pub_date')[:5]
        template = loader.get_template('myapp/index.html')
        context = Context({
        'latest_poll_list': latest_poll_list,
        })
        return HttpResponse(template.render(context))
    
    
    
    def detail(request, poll_id):
        poll = get_object_or_404(Poll, pk=poll_id)
        return render(request, 'myapp/detail.html', {'poll': poll})
    def results(request, poll_id):
        poll = get_object_or_404(Poll, pk=poll_id)
        return render(request, 'myapp/results.html', {'poll': poll})   
    

Line 34 is here

    
    
            return HttpResponseRedirect(reverse('myapp:results', args=(p.id,))))
    

Can you please help me!


Answer: 
        return HttpResponseRedirect(reverse('results', args=p.id))
    

