PROPOSAL: Custom help text for FilterSet
snowman2 opened this issue · 0 comments
snowman2 commented
What are your thoughts on adding optional help_text
to the FilterSet
.
Here is an example of how we use it:
class AttributeFilter(FilterSet):
class Meta(object):
model = Attribute
fields = {
"id": ["exact", "in"],
"name": ["exact", "iexact", "icontains", "contains"],
}
help_text = {
"id": {
"exact": "id/primary key for an Attribute entry.",
"in": "Comma separated list of ids/primary keys for a set of Attribute entries.",
},
"name": {
"exact": "Attribute name field.",
"iexact": "Case insensitive search for attribute name field.",
"icontains": "Case insensitive `like` search for Attribute names.",
"contains": "Case sensitive `like` search for Attribute names.",
},
}
This is useful when auto-generating API documentation.
cc: @alfredoahds
Note: I should add that we would be willing to submit a PR if you would like to see this added.