[Answer]-Using database values in django queryset

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')

Leave a comment