1👍
It makes no sense to say filter(field_name)
: a filter means that a field is the same, less than, contains, etc. some value, or the value of some other field.
You can for example filter with:
MyModel.objects.filter(field_name=some_value)
or check if it is not null with:
MyModel.objects.filter(field_name__isnull=False)
if field_name
is a ForeignKey
, we will thus only retain MyModel
s where the ForeignKey
does not point to None
/NULL
.
Source:stackexchange.com