parent
bde814142a
commit
08df3dd937
|
@ -125,8 +125,7 @@ class OracleOperations(BaseSpatialOperations, DatabaseOperations):
|
|||
geometry_fields = (
|
||||
'PointField', 'GeometryField', 'LineStringField',
|
||||
'PolygonField', 'MultiPointField', 'MultiLineStringField',
|
||||
'MultiPolygonField', 'GeometryCollectionField', 'GeomField',
|
||||
'GMLField',
|
||||
'MultiPolygonField', 'GeometryCollectionField',
|
||||
)
|
||||
if internal_type in geometry_fields:
|
||||
converters.append(self.convert_textfield_value)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.contrib.gis.db.models.sql.conversion import (
|
||||
AreaField, DistanceField, GeomField, GMLField,
|
||||
AreaField, DistanceField,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
'AreaField', 'DistanceField', 'GeomField', 'GMLField'
|
||||
'AreaField', 'DistanceField',
|
||||
]
|
||||
|
|
|
@ -4,22 +4,10 @@ database.
|
|||
"""
|
||||
from decimal import Decimal
|
||||
|
||||
from django.contrib.gis.db.models.fields import GeoSelectFormatMixin
|
||||
from django.contrib.gis.geometry.backend import Geometry
|
||||
from django.contrib.gis.measure import Area, Distance
|
||||
from django.db import models
|
||||
|
||||
|
||||
class BaseField:
|
||||
empty_strings_allowed = True
|
||||
|
||||
def get_db_converters(self, connection):
|
||||
return [self.from_db_value]
|
||||
|
||||
def select_format(self, compiler, sql, params):
|
||||
return sql, params
|
||||
|
||||
|
||||
class AreaField(models.FloatField):
|
||||
"Wrapper for Area values."
|
||||
def __init__(self, area_att=None):
|
||||
|
@ -73,32 +61,3 @@ class DistanceField(models.FloatField):
|
|||
|
||||
def get_internal_type(self):
|
||||
return 'DistanceField'
|
||||
|
||||
|
||||
class GeomField(GeoSelectFormatMixin, BaseField):
|
||||
"""
|
||||
Wrapper for Geometry values. It is a lightweight alternative to
|
||||
using GeometryField (which requires an SQL query upon instantiation).
|
||||
"""
|
||||
# Hacky marker for get_db_converters()
|
||||
geom_type = None
|
||||
|
||||
def from_db_value(self, value, expression, connection, context):
|
||||
if value is not None:
|
||||
value = Geometry(value)
|
||||
return value
|
||||
|
||||
def get_internal_type(self):
|
||||
return 'GeometryField'
|
||||
|
||||
|
||||
class GMLField(BaseField):
|
||||
"""
|
||||
Wrapper for GML to be used by Oracle to ensure Database.LOB conversion.
|
||||
"""
|
||||
|
||||
def get_internal_type(self):
|
||||
return 'GMLField'
|
||||
|
||||
def from_db_value(self, value, expression, connection, context):
|
||||
return value
|
||||
|
|
Loading…
Reference in New Issue