Used features in GIS sitemap view conditionals

This commit is contained in:
Claude Paroz 2015-01-17 12:41:18 +01:00
parent 53e1423eda
commit 428c884083
1 changed files with 4 additions and 4 deletions

View File

@ -31,14 +31,14 @@ def kml(request, label, model, field_name=None, compress=False, using=DEFAULT_DB
connection = connections[using] connection = connections[using]
if connection.ops.postgis: if connection.features.has_kml_method:
# PostGIS will take care of transformation. # Database will take care of transformation.
placemarks = klass._default_manager.using(using).kml(field_name=field_name) placemarks = klass._default_manager.using(using).kml(field_name=field_name)
else: else:
# There's no KML method on Oracle or MySQL, so we use the `kml` # If the database offers no KML method, we use the `kml`
# attribute of the lazy geometry instead. # attribute of the lazy geometry instead.
placemarks = [] placemarks = []
if connection.ops.oracle: if connection.features.has_transform_method:
qs = klass._default_manager.using(using).transform(4326, field_name=field_name) qs = klass._default_manager.using(using).transform(4326, field_name=field_name)
else: else:
qs = klass._default_manager.using(using).all() qs = klass._default_manager.using(using).all()