Code review comment for lp:~arthur-she/lava-dashboard/fix-for-bug-1175597

Revision history for this message
Stevan Radaković (stevanr) wrote :

Hey Arthur,

so instead of all the if/else business, code would look something like this (maybe not 100% accurate didn't try it in the codebase:)

kwargs = {
    name: name,
    '{0}__{1}'.format('value', equation): value,
    content_type_id=content_type_id
}

conditions.append(models.Q(id__in=NamedAttribute.objects.filter(**kwargs).values('object_id')))

I may be missing some quotes but you'll figure it out :)

« Back to merge proposal