Skip to content

Commit

Permalink
Add django-filter to dependencies
Browse files Browse the repository at this point in the history
DRF used to transparently import `django-filter` but it doesn't anymore in 3.7 (which is required by Wagtail 2.0), see encode/django-rest-framework#5273.

As a side effect, close #19.
  • Loading branch information
Loic Teixeira committed Jul 2, 2018
1 parent 4c8ca3a commit 8608bd7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@


install_requires = [
'wagtail>=2.0b1' # Depends on Wagtail's Django and Django RestFramework depencencies
'wagtail>=2.0b1', # Depends on Wagtail's Django and Django RestFramework depencencies
'django-filter>=1.1.0,<2',
]

# Testing dependencies
Expand Down
8 changes: 5 additions & 3 deletions wagtailmodelchoosers/views.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import requests
from django.apps import apps
from django.db.models import CharField, Q
from rest_framework import filters, serializers
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import serializers
from rest_framework.authentication import BasicAuthentication, SessionAuthentication
from rest_framework.filters import SearchFilter
from rest_framework.mixins import ListModelMixin
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
Expand All @@ -20,7 +22,7 @@ class ModelView(ListModelMixin, GenericViewSet):
pagination_class = GenericModelPaginator
authentication_classes = (SessionAuthentication, BasicAuthentication)
permission_classes = (IsAuthenticated,)
filter_backends = (filters.DjangoFilterBackend, filters.SearchFilter,)
filter_backends = (DjangoFilterBackend, SearchFilter,)

def get_params(self):
return self.request.parser_context.get('kwargs')
Expand Down Expand Up @@ -100,7 +102,7 @@ def build_serializer(self, cls, model_name):
class RemoteResourceView(ViewSet):
authentication_classes = (SessionAuthentication, BasicAuthentication)
permission_classes = (IsAuthenticated,)
filter_backends = (filters.DjangoFilterBackend, filters.SearchFilter,)
filter_backends = (DjangoFilterBackend, SearchFilter,)
http_method_names = ('get', 'head', 'options')

def get_params(self):
Expand Down

0 comments on commit 8608bd7

Please sign in to comment.