Repository: readthedocs/readthedocs.org

Issue:
Update django-filter to 1.0
## Details

Sorry for deleting the issue template: This is about technical debt :) It may not be immediately critical, but the advice from the author of django-filter is that it's worth it.

django-filter 1.0 has changes that are backwards incompatible. The release notes are here:

http://django-filter.readthedocs.io/en/latest/migration.html

It means, amongst other this, that all where  `Filter` object instances are iterated on, we have to [add the `.qs` method](http://django-filter.readthedocs.io/en/latest/migration.html#queryset-methods-are-no-longer-proxied).
Pin django-filter
The new 1.0 series is incompatible, and I've opened #2498 for this purpose.

Meanwhile, as the current master is broken because of this, the version should be pinned - I guess it's sort of bad practice to use the `master` branch anyways, am thinking it's possibly also an outdated decision now.

This fixes #2495 and #2490


Discussion:
Hi @benjaoming - I'm partly to blame for the API breakage 😅. Feel free to ping me if you have any questions about the changes.

@rpkilby - thanks! it's a major version bump and with a nice migration guide so it's all in good order I guess :) I've opened the issue, hoping that someone who knows the codebase well is going to do the refactor.. I'm shying away here.



Resolving patch:
diff --git a/readthedocs/builds/filters.py b/readthedocs/builds/filters.py
--- a/readthedocs/builds/filters.py
+++ b/readthedocs/builds/filters.py
@@ -27,9 +27,9 @@ class VersionFilter(django_filters.FilterSet):
     project = django_filters.CharFilter(name='project__slug')
     # Allow filtering on slug= or version=
     slug = django_filters.CharFilter(label=_("Name"), name='slug',
-                                     lookup_type='exact')
+                                     lookup_expr='exact')
     version = django_filters.CharFilter(label=_("Version"), name='slug',
-                                        lookup_type='exact')
+                                        lookup_expr='exact')
 
     class Meta:
         model = Version
@@ -37,7 +37,7 @@ class Meta:
 
 
 class BuildFilter(django_filters.FilterSet):
-    date = django_filters.DateRangeFilter(label=_("Build Date"), name="date", lookup_type='range')
+    date = django_filters.DateRangeFilter(label=_("Build Date"), name="date", lookup_expr='range')
     type = django_filters.ChoiceFilter(label=_("Build Type"),
                                        choices=BUILD_TYPES)
 
diff --git a/readthedocs/projects/filters.py b/readthedocs/projects/filters.py
--- a/readthedocs/projects/filters.py
+++ b/readthedocs/projects/filters.py
@@ -44,17 +44,17 @@ class ProjectFilter(django_filters.FilterSet):
     """Project filter for filter views"""
 
     name = django_filters.CharFilter(label=_("Name"), name='name',
-                                     lookup_type='icontains')
+                                     lookup_expr='icontains')
     slug = django_filters.CharFilter(label=_("Slug"), name='slug',
-                                     lookup_type='icontains')
+                                     lookup_expr='icontains')
     pub_date = django_filters.DateRangeFilter(label=_("Created Date"),
                                               name="pub_date")
     repo = django_filters.CharFilter(label=_("Repository URL"), name='repo',
-                                     lookup_type='icontains')
+                                     lookup_expr='icontains')
     repo_type = django_filters.ChoiceFilter(
         label=_("Repository Type"),
         name='repo',
-        lookup_type='icontains',
+        lookup_expr='icontains',
         choices=REPO_CHOICES,
     )
 
@@ -65,7 +65,7 @@ class Meta:
 
 class DomainFilter(django_filters.FilterSet):
     project = django_filters.CharFilter(label=_("Project"), name='project__slug',
-                                        lookup_type='exact')
+                                        lookup_expr='exact')
 
     class Meta:
         model = Domain


Test patch: