> I read there: > from django.shortcuts import render_to_response > from mysite.polls.model import Poll > def index(request): > latest_poll_list = Poll.objects.all() > &c. > > What is 'latest_poll_list'? I assume it is a list, but a list of what? > Records? Can I cycle through that list (for X in latest_poll_list...) > and are the items in the list then again lists that contain the field > data?
Yes, you can indeed. It's actually not a list, but a QuerySet that functions as an iterator, so you can happily iterate you way through it in either the views or the templates: http://www.djangoproject.com/documentation/db-api/#retrieving-all-objects The individual items are not lists, but objects, related to your models (there's a reason the syntax is 'Poll.objects.all()'). (In part, this is why the Python shell, started through manage.py, is so handy: you can try out things and see what works and what not.) I would advise you to go through the tutorial until you feel you understand it well enough, and anything you don't understand, try and find it in the documentation. Particularly important to read through are Models section (the first 3 items), the template guide for HTML programmers, and the newforms library (assuming you're using the SVN version). Other interesting parts are the 'URL configuration' and 'Request and response objects'. At least, that's my experience. It's all there, although it may take some searching to find it. Google helps, and there's a Google search box right on the docs page for that purpose. Btw, records don't exist in Python, not with that terminology; and if you think of lists that contain lists with field data, you may need to understand the general Python stuff first. In particular the section on classes: http://docs.python.org/tut/node11.html (but reading *and doing* the whole tutorial doesn't hurt, really). --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---