After extensive searching, I'm still unable to find a way to reference
individual items in a list without using a for loop.
For example, I have this basic code in my views.py:
project_list = Project.objects.all().order_by('-id')[:6]
t = loader.get_template('portfolio/index.php')
c = Context({
'project_list' : project_list,
})
Now, in my template file I want to be able reference the six
different elements in the list directly, without having to loop
through them. How can I do this?
I've tried project_list[1] but that just errors out.
Thanks,
Walt
-~
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---