Ejemplo n.º 1
0
 def _add_qs(self, qs):
     if isinstance(qs, ModelBase) and qs._meta.abstract:
         for sub in get_sub_models(qs, direct=True):
             self._add_qs(sub)
     else:
         qs = get_query_set(qs)
         if qs.model in self.querysets_by_model:
             model_qs = self.querysets_by_model[qs.model]
             index = self.querysets.index(model_qs)
             qs = qs | model_qs
             self.querysets[index] = qs
         else:
             self.querysets.append(qs)
         self.querysets_by_model[qs.model] = qs
Ejemplo n.º 2
0
 def get_query_set(self):
     if self.model._meta.abstract:
         models = get_sub_models(self.model, abstract=False, direct=True)
         return ObjectIdentity.objects.filter(type__in=[Type.objects.get_for_model(model) for model in models])
     else:
         return super(ObjectManager, self).get_query_set()