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