philipn/django-rest-framework-filters

Raise exception for auto filters if Meta.model not provided

Closed this issue · 1 comments

If a user does not provide a Meta.model, auto filters are simply skipped over. If a user has declared auto/related filters, this should raise a TypeError or similar instead.

# If model is defined, process auto filters
if new_class._meta.model is not None:
cls.expand_auto_filters(new_class)

This conflicts with #82. While this is technically a silent failure, users will notice the missing filters and debug the issue. On the other hand, enforcing this loses the flexibility of generic filter mixins that don't declare a model, so this isn't worth the tradeoff.