Created
July 21, 2020 07:48
-
-
Save sergeybe/9b41610ff41da40415872de35f43857a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db.models import Lookup | |
from django.db.models.fields import Field | |
@Field.register_lookup | |
class NotEqual(Lookup): | |
lookup_name = 'ne' | |
def as_sql(self, compiler, connection): | |
lhs, lhs_params = self.process_lhs(compiler, connection) | |
rhs, rhs_params = self.process_rhs(compiler, connection) | |
params = lhs_params + rhs_params | |
return '%s <> %s' % (lhs, rhs), params |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment