Hi guys,

i ran into a problem today which i'm not sure if it's a bug (or a
feature?!) so you might can help me:

when i call a model manager method to manipulate the queryset and
using Q objects for filtering, it seems like the query of the method
(=queryset.query) "stores" the result of subqueries and not the
subquery itself.
this causes, of course, into some 'old' data sometimes, so i wondered
if this is correct?

a simple example:
this is the manager for my model Bar and there is also some other
model having a foreign key to this one

def get_my_stuff(self):
  return self.filter(Q(field_1='foobar') | Q(pk__in=[foo.bar_id for
foo in SomeOtherModel.objects.all()])

the problem is now, that the result of the subquery ([foo.bar_id for
foo in SomeOtherModel.objects.all()]) is stored as fixed value (and
not as subquery) in the query and changes in SomeOtherModel objects
are not recognized correctly.

Any advises?

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