Ah *geez* not the "bug due to typo which you can't see b/c you've been
looking at the code nonstop for way to long" problem....
*headdesk*  That's what I get for looking at the django tables
directly in mysql to recall the columns.

Thanks, guys.  Dammit, I hate it when I do that.

So, I'm thinking too much in sql terms, I guess?  I was thinking in
terms of
having a list (or dictionary, rather) of the given items passed along
to the template.   If I understand select_related correctly,
that performs the sql queries upfront so that the queries are not
triggering extra db lookups
when I do the actual pd_list.in_array.* references in my template?

Again, many thanks & apologies for not understanding the first reply.

--Cindy

On Aug 17, 6:33 am, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Aug 17, 1:57 pm, Cindy <tit...@gmail.com> wrote:
>
> > But that filter will just give me a list of tuples with
> > RaidPhysicalDrive's values.  I want to understand how I can include
> > in the list I send to my template, the *additional* values for system
> > name, storage name, and array name, so I can display/dump
> > all the info in a table.  I don't want to put in a link to RPD's
> > in_array value and force the user to drill down two layers to get to
> > the system name.
> > I don't want to also pass in lists of array names, storage names, and
> > system names and do nested forloops with if's to check -- that's
> > the whole point of a well crafted select statement, so that you have
> > your info all sorted out and ready to go.
>
> You don't need to get those elements explicitly. They are provided for
> you via the ORM. So if, as Alec suggests, you start with a queryset of
> all the RaidPhysicalDrive objects related (via the other tables) to
> your System, you can access the intermediate items with dot lookups in
> the template - again, as Alec said, your problem is you're accessing
> ``pd.in_array_id`` instead of ``pd.in_array``.
>
> You can make the query more efficient by using `select_related`:
> RaidPhysicalDrive.objects.filter(in_array__in_storage__in_system__id=id).select_related()
> --
> 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-us...@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