Django

Code

Show
Ignore:
Timestamp:
07/19/08 09:17:24 (6 months ago)
Author:
jbronn
Message:

gis: Added the geographic-enabled forms and admin modules.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/gis/django/contrib/gis/db/models/fields/__init__.py

    r7840 r7980  
     1from django.contrib.gis import forms 
    12from django.db import connection 
    23# Getting the SpatialBackend container and the geographic quoting method. 
     
    112113                raise ValueError('Could not create geometry from lookup value: %s' % str(value)) 
    113114        else: 
    114             raise TypeError('Cannot use parameter of `%s` type as a geometry lookup parameter.' % type(value)) 
     115            raise TypeError('Cannot use parameter of `%s` type as lookup parameter.' % type(value)) 
    115116 
    116117        # Assigning the SRID value. 
     
    137138        # Setup for lazy-instantiated Geometry object. 
    138139        setattr(cls, self.attname, GeometryProxy(SpatialBackend.Geometry, self)) 
     140 
     141    def formfield(self, **kwargs): 
     142        defaults = {'form_class' : forms.GeometryField,  
     143                    'geom_type' : self._geom, 
     144                    'null' : self.null, 
     145                    } 
     146        defaults.update(kwargs) 
     147        return super(GeometryField, self).formfield(**defaults) 
    139148 
    140149    def get_db_prep_lookup(self, lookup_type, value):