def query_or(cls, query, *values_list, **annotations):
pop_annotations = False
if 'pop_annotations' in annotations:
pop_annotations = annotations['pop_annotations']
annotations.pop('pop_annotations')
annotated_keys = annotations.values()
annotations = {key: F(value) for key, value in annotations.items()}
if isinstance(query, Iterable):
query = reduce(or_, query)
result = cls.objects.filter(query).values(*values_list).annotate(**annotations)
if pop_annotations:
for querydict in result:
for value in annotated_keys:
querydict.pop(value)
return result
# tipos de impuestos aplicables a los productos
评论列表
文章目录