Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PROPOSAL: Custom help text for FilterSet #354

Open
snowman2 opened this issue May 13, 2021 · 0 comments
Open

PROPOSAL: Custom help text for FilterSet #354

snowman2 opened this issue May 13, 2021 · 0 comments

Comments

@snowman2
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant