7👍
✅
Use **
dictionary-to-kw-args expansion:
q = Q()
for field in fields:
q = q | Q(**{field: "value"})
(as Q()
yield a Q
which “does nothing”, as far as I can tell)
Source:stackexchange.com