1👍
✅
Use F expressions to have a query field refer to another.
from django.db.models import F
Entry.objects.filter( n_comments__gt=F('n_pingbacks') )
0👍
You need to use the F()
expression
In your example it would look like:
from django.db.models import F
Table.objects.filter(value1__gt=F('value2')).values('value1', 'value2')
- [Answer]-Django model form multiplechoice change or remove field
- [Answer]-How to see if a field changed in model save method
- [Answer]-Returning a variable inside a SessionWizardView
- [Answer]-Accessing global variables after setting them javascript
- [Answer]-Send email django from any host
Source:stackexchange.com