CheckConstraint checking that the sum of fields do not exceed a value

I posted a question on StackOverflow then remembered this forum. I am repeating the post here. I hope that’s OK.

How should one approach writing a CheckConstraint for model that triggers when the sum of two fields exceeds the value of another? I am able to do a CheckConstraint that triggers when the value of one field exceeds another. How do I adapt that to include summation?

For example:
the following checks that value in ‘entry’ field does not exceed the value in ‘limit’
check=models.Q(entry__lte=models.F("limit"))

But I want to do something like
check=models.Q(F('entry') + F('extra') <= models.F("limit"))

I am not sure the above attempt works since it is using native python operators.

You can revert the operator:

 check=models.Q(limit__gte=F('entry') + F('extra'))

Thanks a lot. That never occured to me