Exception Type: TypeError Exception Value: individual() takes exactly 2 arguments (1 given)

24 views
Skip to first unread message

muhammed riyas

unread,
Nov 12, 2012, 7:49:44 AM11/12/12
to django...@googlegroups.com
Request Method:GET
Exception Type:TypeError
Exception Value:individual() takes exactly 2 arguments (1 given)
Exception Location:/home/user/google_appengine/lib/django_0_96/django/core/handlers/base.py in get_response, line 77



url is  (r'^employee/[0-9]+/$','qburstemployeeapp.main.views.individual'),

in this the [0-9]+ denotes id number for the user ...

in my view...



def individual(request,id):
    employees = Employeeprofile.all()
    for employee in employees:
        if(employee.key().id() == id):
return render_to_response('main/individual1.html', { 'employee' : employee }) 

What is the mistake?...


Thanks in advance....

Jonathan D. Baker

unread,
Nov 12, 2012, 7:58:44 AM11/12/12
to django...@googlegroups.com
You need to capture the id parameter in your URL by wrapping it in parentheses: ([0-9])

Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/PJcdrn57HooJ.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

muhammed riyas

unread,
Nov 12, 2012, 8:37:11 AM11/12/12
to django...@googlegroups.com
thanks it works fine, but the if statement is not working,,, why?  it always gives the first result?.....

Daniel Roseman

unread,
Nov 12, 2012, 9:39:09 AM11/12/12
to django...@googlegroups.com
On Monday, 12 November 2012 08:37:44 UTC, muhammed riyas wrote:
thanks it works fine, but the if statement is not working,,, why?  it always gives the first result?.....


This is a question about AppEngine, not Django. Please post it to the appropriate list.

(Hint: you absolutely certainly do *not* want to be iterating over every entity in the datastore until you find a match.)
--
DR.

muhammed riyas

unread,
Nov 12, 2012, 9:43:48 AM11/12/12
to django...@googlegroups.com
sorry....:)

Dominik Przybysz

unread,
Nov 12, 2012, 8:42:06 AM11/12/12
to django...@googlegroups.com
You have to convert id to int

W dniu 12.11.2012 09:37, muhammed riyas pisze:
-- 
Pozdrawiam,
Dominik Przybysz
Reply all
Reply to author
Forward
0 new messages