I have something like this:

class MyManager(models.Manager):
    use_for_related_fields = True
    def get_query_set(self):
        return super(MyManager, self).get_query_set().extra(select =
{'_extra_field':"xxx"})
class ModelA(models.Model):
    ...
    objects = MyManager()

class ModelB(models.Model):
    ...
    ref = models.ForeignKey(ModelA)


When I override the get_query_set() adding extra fields, these fields
aren't available if I execute:
ModelB.objects.all().select_related('ref')


This is a bug? If not, how can I get the extra fields from ModelA
through ModelB with only one query?
I need this cause I have to display a list of 50+ ModelBs and i can't
execute 50+ queries only for that..

Gleber

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to