How to get the filter class through model?
Closed this issue · 3 comments
Scheinin commented
I can't find an effective way. Has anyone implemented it?
rpkilby commented
Hi @Scheinin. Can you provide more information about what you expect to see? e.g., what do you expect to provide as input, and what do you expect in return?
Scheinin commented
class ManagerFilter(filters.FilterSet):
class Meta:
model = Manager
fields = {'name': ['exact', 'in', 'startswith']}
For example, I have this filter class. How can I get the ManagerFilter
only through the Manager
.
rpkilby commented
No. This is the minimal amount of code necessary to configure a FilterSet
. It's basically the same API that's used by DRF serializers and Django model forms.