'RegexURLResolver' object has no attribute 'default_args'

76 views
Skip to first unread message

jon

unread,
Dec 23, 2016, 10:42:46 AM12/23/16
to Django users
I am a newbie to Django, coming from PHP/Yii. I have gotten to the part 4 of the official Django tutorial but can't seem to get by this error.

I have looked online and in this forum but cannot find anything on this specific error.

Error:

AttributeError at /polls/1/vote/

'RegexURLResolver' object has no attribute 'default_args'
Request Method:POST
Request URL:http://127.0.0.1:8000/polls/1/vote/
Django Version:1.8.4
Exception Type:AttributeError
Exception Value:
'RegexURLResolver' object has no attribute 'default_args'


View: 

def vote(request, question_id):
question = get_object_or_404(Question, pk=question_id)
try:
selected_choice = question.choice_set.get(pk=request.POST['choice'])
except (KeyError, Choice.DoesNotExist):
return render(request, 'polls/detail.html', {
'question': question,
'error_message': "You didn't select a choice.",
})
else:
selected_choice.votes += 1
selected_choice.save()
return HttpResponseRedirect(reverse('polls:results', args=(question.id,)))


ludovic coues

unread,
Dec 24, 2016, 7:36:11 PM12/24/16
to django...@googlegroups.com
There is a stack trace below the error. It should provide a lot of information on where the error happened in your code

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/eaf2b01a-9a29-4b1e-867a-382291af54cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages