On Sep 17, 1:48 pm, adelaide_mike <mike.ro...@internode.on.net> wrote:
> Hello
> I, a newbie to Django and Python, have a model thus:
>
> class Person(model.Models):
>     first_name = models.CharField(max_length=32)
>     last_name = models.CharField(max_length=32)
>
> In my view.py can do this, to illustrate my question:
>
> def testing(request):
>     persons = Person.objects.all()
>     print "persons=", persons         #prints OK
>     print "the value in the third column of the second row is ", ??
> what goes here??
>     return render_to_response('xyz/testing.html', {'persons':
> persons})
>
> I imagine there is a way to do this, surely, otherwise how can I use
> ifchanged in my template.  I have battled this for days, got various
> responses from various esteemed sources, but I don't get it. Any help
> available as in "the answer is..." ?  Your patience is appreciated.
>
> Mike

What do you mean by 'row' and 'column' here? Are you referring to
database rows/columns?

You can get the second Person object in your result set by doing
persons[2], and get the last_name field by doing persons[2].last_name,
but the 'third column' has no particular meaning in Django, because a
model is not a database object and its fields have no particular
order.

I don't understand the reference to ifchanged, or what it has to do
with columns and rows.
--
DR.
--~--~---------~--~----~------------~-------~--~----~
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