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

2013-09-21 Thread Trung Nguyen

If I pass in a variable to the template like 

 return render_to_response("grading_school_form.html",  
RequestContext(request, { "formset": formset, "pk":school_id, "spk":1}))
 
then in the template 
  
   {% for form in formset %}


   {{ spk }}
 {{ form.first_name }}
{{ form.last_name}}
 {{ form.schoolName }}
Enter Student Score 

{% endfor %}

It does work.

But i need to dynamicly assign the form ID  to the student id like 
student_id= form.instanse.pk
then it complain
like 

everse for 'gradingstudent' with arguments '()' and keyword arguments 
'{u'student_id': None, u'school_id': 1}' not found.


when i try to assign spk = form.instanse.pk
like
{% with form.instance.id.to_int as spk%}

   {{ spk }}
 {{ form.first_name }}
{{ form.last_name}}
 {{ form.schoolName }}
Enter Student Score 
{% endwith %}

 
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\d+)/gradings/gradingstudent/(?P\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 >> 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 >>
>>> if I change to this url
>>>
>>>  a href="{% url 'contest:gradingstudent'  school_id=1 student_id %}"> {{
>>> form.instance.id}}  Enter Student Score >> 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 django-users+unsubscr...@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.


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

2013-09-21 Thread Trung Nguyen


On Friday, September 20, 2013 10:44:33 PM UTC-5, 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\d+)/gradings/gradingstudent/(?P\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  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 
> if I change to this url
>
>  a href="{% url 'contest:gradingstudent'  school_id=1 student_id %}"> {{
> form.instance.id}}  Enter Student Score  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+unsubscr...@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.


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

2013-09-21 Thread Trung Nguyen
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\d+)/gradings/gradingstudent/(?P\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 >> 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 >>
>>> if I change to this url
>>>
>>>  a href="{% url 'contest:gradingstudent'  school_id=1 student_id %}"> {{
>>> form.instance.id}}  Enter Student Score >> 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 django-users+unsubscr...@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.


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

2013-09-21 Thread Trung Nguyen
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\d+)/gradings/gradingstudent/(?P\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 > 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 >
>> if I change to this url
>>
>>  a href="{% url 'contest:gradingstudent'  school_id=1 student_id %}"> {{
>> form.instance.id}}  Enter Student Score > 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 django-users+unsubscr...@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.


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

2013-09-21 Thread arjun
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.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\d+)/gradings/gradingstudent/(?P\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  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 
> if I change to this url
>
>  a href="{% url 'contest:gradingstudent'  school_id=1 student_id %}"> {{
> form.instance.id}}  Enter Student Score  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+unsubscr...@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.


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

2013-09-21 Thread Daniel Roseman
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\d+)/gradings/gradingstudent/(?P\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  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 
> if I change to this url
>
>  a href="{% url 'contest:gradingstudent'  school_id=1 student_id %}"> {{
> form.instance.id}}  Enter Student Score  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 django-users+unsubscr...@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.


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

2013-09-20 Thread Trung Nguyen
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\d+)/gradings/gradingstudent/(?P\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   Enter Student Score  
{{form.instance.id}}  Enter Student Score http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.