rsinger86/drf-flex-fields

Filter Backend for Query optimization using wrong check

Closed this issue · 0 comments

jsatt commented

In the filter backend for optimizing the queries, the backend is doing a check to confirm that the serializer being used is a valid FlexFields serializer.
https://github.com/rsinger86/drf-flex-fields/blob/master/rest_flex_fields/filter_backends.py#L19

However I think rather than checking for the FlexFieldsModelSerializer, the proper check should be for a instance of FlexFieldsSerailizerMixin, as this mixin is what actually contains the functionality needed by the filter backend.

There are several cases in my project where we are having to build our own ModelSerializers where it doesn't make sense or could break things to introduce an additional ModelSerializer to the MRO, especially just to add the functionality provided by simply adding FlexFieldsSerializerMixin.