Skip to content

AllLookupsFilter does not work w/ FilterSet mixins #82

Closed
@NotSqrt

Description

@NotSqrt

Hi !

cf https://docs.djangoproject.com/en/1.9/topics/db/models/#abstract-base-classes

Is there an equivalent for FilterSets ?

When I do:

class FilterMixin(FilterSet):
    common_field = AllLookupsFilter('field_name')

   # no possibility to do:
   # class Meta:
   #    abstract = True

class ActualFilter(FilterMixin, FilterSet):
    # other filters
    class Meta:
        model = MyModel

I get an error :

  File "rest_framework_filters/filterset.py", line 57, in __new__
    field = filterset.get_model_field(model, filter_.name)

If I do class FilterMixin(object): .., the common filters are not detected.

I would really like not having to repeat the fields multiple times !

Thanks !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions