Example #1
0
 def _process_aggregate_args(self, args, kwargs):
     """for aggregate and annotate kwargs: allow ModelX___field syntax for kwargs, forbid it for args.
     Modifies kwargs if needed (these are Aggregate objects, we translate the lookup member variable)"""
     for a in args:
         assert not '___' in a.lookup, 'PolymorphicModel: annotate()/aggregate(): ___ model lookup supported for keyword arguments only'
     for a in kwargs.values():
         a.lookup = translate_polymorphic_field_path(self.model, a.lookup)
Example #2
0
 def _process_aggregate_args(self, args, kwargs):
     """for aggregate and annotate kwargs: allow ModelX___field syntax for kwargs, forbid it for args.
     Modifies kwargs if needed (these are Aggregate objects, we translate the lookup member variable)"""
     for a in args:
         assert not '___' in a.lookup, 'PolymorphicModel: annotate()/aggregate(): ___ model lookup supported for keyword arguments only'
     for a in kwargs.values():
         a.lookup = translate_polymorphic_field_path(self.model, a.lookup)
Example #3
0
 def order_by(self, *args, **kwargs):
     """translate the field paths in the args, then call vanilla order_by."""
     new_args = [ translate_polymorphic_field_path(self.model, a) for a in args ]
     return super(PolymorphicQuerySet, self).order_by(*new_args, **kwargs)
Example #4
0
 def order_by(self, *args, **kwargs):
     """translate the field paths in the args, then call vanilla order_by."""
     new_args = [
         translate_polymorphic_field_path(self.model, a) for a in args
     ]
     return super(PolymorphicQuerySet, self).order_by(*new_args, **kwargs)