Thanks for the reply David.

So what passes the poll context variable to the template? This isn't
done explicitly, right? How is the variable name determined?

Cheers,

On Nov 23, 8:25 pm, "David Zhou" <[EMAIL PROTECTED]> wrote:
> The key is the sentence above that snippet on that page:
>
> "Given the context variable poll"
>
> 'poll' is a variable passed into the template context.  If you called
> that variable 'a_poll', you could've done:
>
> <h1>{{a_poll.question}}</h1>
>
> As for choice, notice the line:
>
> {% for choice in poll.choice_set.all %}
>
> It's populating the choice variable with the items in choice_set.
>
>
>
> On Sun, Nov 23, 2008 at 6:16 AM, dash86no <[EMAIL PROTECTED]> wrote:
>
> >http://docs.djangoproject.com/en/dev/intro/tutorial03/#intro-tutorial03
>
> > I'm following the above tutorial, and I'm confused with the following
> > section:
>
> > <h1>{{ poll.question }}</h1>
> > <ul>
> > {% for choice in poll.choice_set.all %}
> >    <li>{{ choice.choice }}</li>
> > {% endfor %}
> > </ul>
>
> > The 'poll' and 'choice'  are referred to with out the first letters, p
> > and c respectively, being capitalized.
>
> > This is despite the fact that both are declared as 'Poll' and
> > 'Choice', respectively, in the models.py.
>
> > I have tried this in my own app and find the same to be true there
> > too: If I try to refer to a model with a capitalized first letter (as
> > they are declared in my models.py), the template doesn't work.
>
> > I have a feeling this has something to do with the templates dealing
> > with 'Objects' and when an object is instantiated from a class it's
> > first letter is automatically converted to lower case.
>
> > Am I on the right lines here? If so, what happens if you declare your
> > classes with all lower case letters in models.py?
>
> > Thanks,
>
> --
> ---
> David Zhou
> [EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to