Skip to content
Discussion options

You must be logged in to vote

Hey @isaac-blanc — Erm... what you describe as desired is the actual behaviour — or it should be.

From the test suite:

    def test_meta_fields_dictionary_derived(self):
        class F(FilterSet):
            class Meta:
                model = Book
                fields = {
                    "price": ["exact", "gte", "lte"],
                }

        self.assertEqual(len(F.declared_filters), 0)
        self.assertEqual(len(F.base_filters), 3)

        expected_list = [
            "price",
            "price__gte",
            "price__lte",
        ]
        self.assertCountEqual(list(F.base_filters), expected_list)

The form there has the price field you're looking for.

So somethin…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@isaac-blanc
Comment options

Answer selected by isaac-blanc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants