Refs #7742 -- Removed oldforms bits from `contrib.gis` app.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8295 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Gary Wilson Jr 2008-08-11 04:33:27 +00:00
parent dd842ad34d
commit cec69eb70d
2 changed files with 1 additions and 36 deletions

View File

@ -1,11 +1,9 @@
from django.contrib.gis import forms
# Getting the SpatialBackend container and the geographic quoting method.
from django.contrib.gis.db.backend import SpatialBackend, gqn
# GeometryProxy, GEOS, Distance, and oldforms imports.
# GeometryProxy, GEOS, and Distance imports.
from django.contrib.gis.db.models.proxy import GeometryProxy
from django.contrib.gis.measure import Distance
from django.contrib.gis.oldforms import WKTField
# The `get_srid_info` function gets SRID information from the spatial
# reference system table w/o using the ORM.
from django.contrib.gis.models import get_srid_info
@ -190,10 +188,6 @@ class GeometryField(SpatialBackend.Field):
else:
return SpatialBackend.Adaptor(self.get_geometry(value))
def get_manipulator_field_objs(self):
"Using the WKTField (oldforms) to be our manipulator."
return [WKTField]
# The OpenGIS Geometry Type Fields
class PointField(GeometryField):
_geom = 'POINT'

View File

@ -1,29 +0,0 @@
from django.core.validators import ValidationError
from django.oldforms import LargeTextField
from django.contrib.gis.geos import GEOSException, GEOSGeometry
class WKTField(LargeTextField):
"An oldforms LargeTextField for editing WKT text in the admin."
def __init__(self, *args, **kwargs):
super(WKTField, self).__init__(*args, **kwargs)
# Overridding the validator list.
self.validator_list = [self.isValidGeom]
def render(self, data):
# Returns the WKT value for the geometry field. When no such data
# is present, return None to LargeTextField's render.
if isinstance(data, GEOSGeometry):
return super(WKTField, self).render(data.wkt)
elif isinstance(data, basestring):
return super(WKTField, self).render(data)
else:
return super(WKTField, self).render(None)
def isValidGeom(self, field_data, all_data):
try:
g = GEOSGeometry(field_data)
except GEOSException:
raise ValidationError('Valid WKT or HEXEWKB is required for Geometry Fields.')