django - What queryset expression produces "where x != 123" for nullable field? -
i have nullable field:
class test(models.model): x = models.integerfield(null=true, blank=true)
i want find instances x != 123.
print(test.objects.filter(x__isnull=false).exclude(x=123).query) select [...] testdb_test (x not null , not (x = 123 , x not null))
but obscure reasons need query produce precisely where x != 123
. know 2 equivalent in terms of records selected.
i'd rather not use extra() because docs state deprecated in future. there other way where x != 123
?
Comments
Post a Comment