Skip to content

Commit

Permalink
Merge d3ffed3 into 7162787
Browse files Browse the repository at this point in the history
  • Loading branch information
coredumperror committed Oct 23, 2018
2 parents 7162787 + d3ffed3 commit adbf330
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions djgeojson/views.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import math

import django
from django.core.exceptions import ImproperlyConfigured

try:
from django.contrib.gis.db.models.functions import Intersection
except ImportError:
pass
except (ImportError, ImproperlyConfigured):
Intersection = None
from django.views.generic import ListView
from django.utils.decorators import method_decorator
from django.views.decorators.gzip import gzip_page
Expand Down Expand Up @@ -149,7 +150,8 @@ def get_queryset(self):
# Won't trim point geometries to a boundary
model_field = qs.model._meta.get_field(self.geometry_field)
self.trim_to_boundary = (self.trim_to_boundary and
not isinstance(model_field, PointField))
not isinstance(model_field, PointField) and
Intersection)
if self.trim_to_boundary:
if django.VERSION < (1, 9):
qs = qs.intersection(bbox)
Expand Down

0 comments on commit adbf330

Please sign in to comment.