Reputation:
class Student():
name=models.CharField(max_length=200)
surname=models.CharField(max_length=200)
class groupA():
name=models.CharField(max_length=200)
math=models.DecimalField(decimal_places=2,max_digits=1000)
english=models.DecimalField(decimal_places=2,max_digits=1000)
biology=models.DecimalField(decimal_places=2,max_digits=1000)
chemistry=models.DecimalField(decimal_places=2,max_digits=1000)
How to filter the ready list based on type_1 > 2 and type_2 < 1 ?
Upvotes: 0
Views: 44
Reputation: 88499
Something like this,
result = groupA.objects.annotate(
type_1=F('math') / F('english'),
type_2=F('chemistry') / F('math'),
).filter(type_1__gt=2, type_2__lt=1)
Upvotes: 2