I have a model with a very big field and a special manager to defer that field by default.
class ModelAManager(models.Manager): def get_queryset(self, *args, **kwargs): return super().get_queryset(*args, **kwargs).defer("big_field") class ModelA(models.Model): big_field = models.TextField() objects = ModelAManager() class Meta: base_manager_name = "objects"
This works fine. When I use
big_field does not get queried from DB.
However I also have
ModelB with FK to
ModelA and when using select related:
Manager is not used and
big_field is queried. Any way around it?
I have lots of places where ‘model_a’ gets select_related. I’d like to be able to defer big field without modifying all these places.