hi to all, i am a real newbie when it comes to django(4days).
I have the following question:

Let's say i have the following files

#views.py
from django.contrib.auth.models import User


def aview(request):
    a_user = User.objects.filter(username="djanog")
    users = User.objects.all()
    return render_to_response('temp.html',
                              {
                                  'user' : a_user,
                                  'users' : users,
                              }
                             )

#temp.html

<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">

    <title>Django Entry Page -- aggelidis09</title>

</head>
<body>
    <h1 id="">Demo for user model</h1>
    <p>{{ user }} has the following fields</p>
    <p>s{{ user.username }}</p>
    <p>{{ user.email }}</p>
    <p>{{ user.last_name }}</p>
    <p>{{ user.first_name }}</p>
    <h1 id="">Demo for user model</h1>
    {% for object in users %}
    <p>A user:</p>
    <p>{{ object.username }}</p>
    <p>{{ object.email }}</p>
    <p>{{ object.last_name }}</p>
    <p>{{ object.first_name }}</p>

    {% endfor %}
</body>
</html>

The for loop with users works as expected, meaning it prints the
requested attributes of each user.
But the invocation of user only prints the {{ user }}, but not
user.username or any other attribute...

any ideas why is this happening??

thanks in advance,
nicolas

--~--~---------~--~----~------------~-------~--~----~
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