[Answer]-Django queryset filter model attribute against other model attribute

1👍

I’m not sure if it will work in this case, but generally you can use F() objects for this.

from django.db.models import F
qs = InstanceItemEvaluation.objects.filter(
    user=user, 
    instance=instance, 
    factor__is_active=True, 
    measure__is_active=True).exclude(
    factor__measure=None).filter(
    factor__measure=F('measure_id'))

Leave a comment