To filter empty or NULL names in a Python Django QuerySet, we can caill the exclude
method.
For instance, we write
Name.objects.exclude(alias__isnull=True).exclude(alias__exact='')
to call exclude
to exclude Name
results that has alias
set to null
with
alias__isnull=True
And we exclude entries with alias
set to an empty string by calling exclude
with
alias__exact=''