I found it. Inside {% %} shoud use variable. Inthis case is
form.instance.id instead of {{form.instance.id}}
On Saturday, September 21, 2013 5:06:07 PM UTC-5, Trung Nguyen wrote:
>
> No this not add form and I verify it. I also use pk but it does not work
> either.
>
> On Saturday, September 21, 2013 7:38:52 AM UTC-5, Daniel Roseman wrote:
>>
>> On Saturday, 21 September 2013 04:44:33 UTC+1, Trung Nguyen wrote:
>>
>>> Django Version:1.5.2Exception Type:NoReverseMatchException 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 424Python Executable:/usr/bin/pythonPython 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,
>>>
>>>
>> The error is telling you that form.instance.id is None. Presumably this
>> is because you are on an add form, and the instance hasn't been created yet
>> - in which case you can't link to its contest page.
>> --
>> DR.
>>
>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.