Closed daisylb closed 5 years ago
ManyRelation
is even uglier: it takes four args, when really it should just take two.
This message on django-developers gives a function that adds a prefix to everything in a Q
object, which should have the same effect as being able to go Q(foo__in=Q(...))
.
Currently,
Relation
has the signatureRelation(attribute_name, model_class, rule)
. Having themodel_class
argument is kind of a pain; ideally,Relation
andAttribute
should have matching signatures, and we should figure out the model class to construct aQuerySet
from when.query()
is called. (What would really be ideal is if we could pass aQ
object directly into{attr}__in
, but Django doesn't let us do that.)