On Wed, 2009-08-05 at 18:27 +1000, Brian May wrote:
> On Wed, Aug 05, 2009 at 04:34:49PM +1000, Malcolm Tredinnick wrote:
> > since it returns a *new* queryset that you cannot save to anything in
> > the template.
> 
> errr... What about:
> 
> {% with object.object_set.select_related as set %}
> ...
> {% endwith %}

Hence why I said it wasn't particularly useful. I didn't say it was
entirely useless. Note, in passing, that the above will retrieve more
data than you want, since it will follow the forwards relation back to
the very object you started from (unless it's a nullable ForeignKey). If
you need to precise control that select_related() offers, using it in
the view is better practice.

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
-~----------~----~----~----~------~----~------~--~---

Reply via email to