Skip to content

Inheriting FilterSet with Metaclass #132

Closed
@detonavomek-zz

Description

@detonavomek-zz

Hi development team,

I find one small error here.
We cannot inherit FilterSet with metaclass.
Inside "filtersets::FilterSet::get_subset" method we used hardcoded "FilterSetMetaclass" metaclass.
When we try to inherit FilterSet and use some metaclass based on FilterSetMetaclass we will get the next error

TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

because here:
https://github.com/Detonavomek/django-rest-framework-filters/blob/2a602efe33e2f38cca4bce504a9930aeb9849a1b/rest_framework_filters/filterset.py#L239
we try to create class based on 'cls', not on 'FilterSet'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions