On 1/9/07, David Cramer <[EMAIL PROTECTED]> wrote:
>
> I'm talking completely about the related objects accessors, and not
> sending models to the templates is not a good solution for us :)
>
> I want to setup some kind of blocking mechanism so that while rendering
> a template the models will not do any SQL queries that have not already
> been executed, or at least block the related field queries.

Well, if you don't want the related objects to be queried at a later
time that the initial object, select_related [1] will do that for you.
Simply put, all related objects are queried at the same time as the
initial object.

I don't know why you would want to block those queries completely. If
your template is asking for them and they're blocked, you'll never get
that info to display in your template. Unless that is what you want,
but then I suggest removing those calls from the template. Seems to me
more like an issue of *when* the SQL queries are executed and
select_related takes care of that.

[1]: http://www.djangoproject.com/documentation/db_api/#select-related

-- 
----
Waylan Limberg
[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