I am trying to implement custom filtering in my code and went through the documentation. But I couldnt understand the following snippets from the docs.
class UserFilter(django_filters.FilterSet):
class Meta:
model = User
fields = ['username', 'last_login']
# or
class UserFilter(django_filters.FilterSet):
class Meta:
model = User
fields = {
'username': ['exact', 'contains'],
'last_login': ['exact', 'year__gt'],
}
The doc says we can use either one the first or second one but what is the exact difference?? What is the meaning of contains and year_gt?