Skip to content

Commit

Permalink
maintain bakwards compatibility for old versions of django-filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Fingel committed Sep 26, 2016
1 parent 78527f6 commit 5b5bc44
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rest_framework_gis/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ class GeoFilterSet(django_filters.FilterSet):
}

def __new__(cls, *args, **kwargs):
cls._meta.filter_overrides.update(cls.GEOFILTER_FOR_DBFIELD_DEFAULTS)
try:
cls._meta.filter_overrides.update(cls.GEOFILTER_FOR_DBFIELD_DEFAULTS)
except AttributeError: # Compatibility for django-filter < 0.15
cls.filter_overrides.update(cls.GEOFILTER_FOR_DBFIELD_DEFAULTS)
cls.LOOKUP_TYPES = sorted(gis_lookups)
return super(GeoFilterSet, cls).__new__(cls)

Expand Down

0 comments on commit 5b5bc44

Please sign in to comment.