From cec69eb70d1e2f84dc5a7fb172da88a79b0f5063 Mon Sep 17 00:00:00 2001 From: Gary Wilson Jr Date: Mon, 11 Aug 2008 04:33:27 +0000 Subject: [PATCH] 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 --- .../contrib/gis/db/models/fields/__init__.py | 8 +---- django/contrib/gis/oldforms/__init__.py | 29 ------------------- 2 files changed, 1 insertion(+), 36 deletions(-) delete mode 100644 django/contrib/gis/oldforms/__init__.py diff --git a/django/contrib/gis/db/models/fields/__init__.py b/django/contrib/gis/db/models/fields/__init__.py index cc4d0a70b5..a1dfa23eb4 100644 --- a/django/contrib/gis/db/models/fields/__init__.py +++ b/django/contrib/gis/db/models/fields/__init__.py @@ -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' diff --git a/django/contrib/gis/oldforms/__init__.py b/django/contrib/gis/oldforms/__init__.py deleted file mode 100644 index 94ef9acc1f..0000000000 --- a/django/contrib/gis/oldforms/__init__.py +++ /dev/null @@ -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.') - - -