On Tue, 2009-08-04 at 09:05 -0700, Joe LB wrote:
> Hi all,
>
> I'm trying to access the related objects in the template by using
>
> {{ .... _set.select_related}}
This isn't particularly useful in a template. Select_related() doesn't
change the values you have access to and it isn't going to save you any
extra database queries on subsequent uses of the original queryset,
since it returns a *new* queryset that you cannot save to anything in
the template.
>
> this works but as its not an instance and it's a query object I get
>
> [<Object: String Here>]
>
> What do I use to just display the string not the object code.
What you are seeing is Python's default repr() display for a QuerySet,
which is actually the repr() display of list(queryset). If you want to
see the results, you have to iterate over the queryset and display the
unicode() or str() value of each element.
Regards,
Malcolm
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---