Saturday, September 21, 2013

Re: and keyword arguments '{u'student_id': None, u'school_id': 1}' not found.

And you shouldn't be using id's. using pk is better!

On Saturday, September 21, 2013 9:14:33 AM UTC+5:30, Trung Nguyen wrote:
Django Version:1.5.2
Exception Type:NoReverseMatch
Exception Value:
Reverse for 'gradingstudent' with arguments '()' and keyword arguments '{u'student_id': None, u'school_id': 1}' not found.
Exception Location:/usr/local/lib/python2.7/dist-packages/django/template/defaulttags.py in render, line 424
Python Executable:/usr/bin/python
Python Version:2.7.4
 I am new to Django. I got this error and struggle to find a solution for it but no luck. Please help!

View.py   def grading_student(request, school_id=1, student_id=1):
urls.py   url(r'^(?P<school_id>\d+)/gradings/gradingstudent/(?P<student_id>\d+)/$', views.grading_student, name='gradingstudent'),

from template :
if I use :
a href="{% url 'contest:gradingstudent'  school_id=1 student_id=1 %}">  Enter Student Score </a
It work. But when I try to replace 1 by form.instance.id i got error about.

 a href="{% url 'contest:gradingstudent'  school_id=1 student_id=form.instance.id %}">  Enter Student Score </a

if I change to this url

 a href="{% url 'contest:gradingstudent'  school_id=1 student_id %}"> {{form.instance.id}}  Enter Student Score </a
I got other error 
Don't mix *args and **kwargs in call to reverse()!
What is the properway to do?

Thanks,

--
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-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate