You have to convert id to int

W dniu 12.11.2012 09:37, muhammed riyas pisze:
thanks it works fine, but the if statement is not working,,, why? it always gives the first result?.....

On Mon, Nov 12, 2012 at 1:28 PM, Jonathan D. Baker <jonathandavidba...@gmail.com <mailto:jonathandavidba...@gmail.com>> wrote:

    You need to capture the id parameter in your URL by wrapping it in
    parentheses: ([0-9])

    Sent from my iPhone

    On Nov 12, 2012, at 12:49 AM, muhammed riyas
    <muhammedriyas.2...@gmail.com
    <mailto:muhammedriyas.2...@gmail.com>> wrote:

    Request Method:GET
    Request URL:http://localhost:9744/employee/1/
    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....

-- 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-users@googlegroups.com <mailto:django-users@googlegroups.com>.
    To unsubscribe from this group, send email to
    django-users+unsubscr...@googlegroups.com
    <mailto:django-users+unsubscr...@googlegroups.com>.
    For more options, visit this group at
    http://groups.google.com/group/django-users?hl=en.
-- You received this message because you are subscribed to the Google
    Groups "Django users" group.
    To post to this group, send email to django-users@googlegroups.com
    <mailto:django-users@googlegroups.com>.
    To unsubscribe from this group, send email to
    django-users+unsubscr...@googlegroups.com
    <mailto:django-users%2bunsubscr...@googlegroups.com>.
    For more options, visit this group at
    http://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
Pozdrawiam,
Dominik Przybysz

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to