Skip to content

Commit

Permalink
Merge 20315ce into cd4e05e
Browse files Browse the repository at this point in the history
  • Loading branch information
leplatrem committed Apr 4, 2014
2 parents cd4e05e + 20315ce commit 4c69a82
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions leaflet/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
from __future__ import unicode_literals

from django.contrib.admin import ModelAdmin
from django.contrib.gis.db import models

try:
from djgeojson.fields import GeoJSONField
except ImportError:
GeoJSONField = type(object)
try:
from django.contrib.gis.db.models import GeometryField
except ImportError:
GeometryField = type(object)

from .forms.widgets import LeafletWidget

Expand All @@ -20,11 +28,7 @@ def formfield_for_dbfield(self, db_field, **kwargs):
Overloaded from ModelAdmin to set Leaflet widget
in form field init params.
"""
try:
from djgeojson.fields import GeoJSONField
except ImportError:
GeoJSONField = type(object)
is_geometry = isinstance(db_field, (models.GeometryField, GeoJSONField))
is_geometry = isinstance(db_field, (GeometryField, GeoJSONField))
is_editable = is_geometry and (db_field.dim < 3 or
self.widget.supports_3d)

Expand Down

0 comments on commit 4c69a82

Please sign in to comment.