Hey Alex,

On the trac ticket, I mentioned that my motivating reason for adding
specifying default-lazy fields in the Field definition (i.e., without
having to specify them on every query set) is the implicit queries
that Django creates for foreign key lookups (e.g., item =
obj.relateditem causes an implicit SQL query, and I want to avoid
loading large text fields on the related item). Also, to a lesser
extent, it would be good to avoid loading these columns in
select_related().

I hadn't thought before about subclassing Query/QuerySet/Manager/
TextField to do this without changing the installed version of Django.
That's an interesting idea. My change did also involve changing
Options (i.e., _meta), though.

Currently, however, the Query and QuerySet classes are functionally
decomposed in a way that makes it hard to override most of this
functionality in a subclass without copy-and-pasting a very large
amount of code. (Compare, for instance,
django.contrib.gis.db.models.sql.Query.get_columns with
django.db.models.sql.Query.get_columns.) I just posted a patch to
http://code.djangoproject.com/ticket/9368 which would make overriding
this functionality somewhat easier. But it would still involve a
considerable amount of code duplication if that logic wasn't in the
Query base class.

-Jesse

On Oct 14, 10:00 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> I think the sensible solution is to have what the ticket originally
> suggested, a queryset/manager method to control whether a field is
> lazy loading, and yes, that can be implemented without patching
> django, you can, of course, make this the default by overiding the
> default manager.
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to