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

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -