Django

Code

Changeset 6243

Show
Ignore:
Timestamp:
09/14/07 17:56:43 (1 year ago)
Author:
jbronn
Message:

gis: Fixed #5438 with patches from rcoup.

Files:

Legend:

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

    r5806 r6243  
    2020        geom_value = obj.__dict__[self._field.attname]  
    2121 
    22         if (geom_value is None) or (isinstance(geom_value, GEOSGeometry)):  
     22        if isinstance(geom_value, GEOSGeometry):  
    2323            # If the value of the field is None, or is already a GEOS Geometry 
    2424            #  no more work is needed. 
    25             geom = geom_value  
     25            geom = geom_value 
     26        elif (geom_value is None) or (geom_value==''): 
     27            geom = None 
    2628        else:  
    2729            # Otherwise, a GEOSGeometry object is built using the field's contents, 
  • django/branches/gis/django/contrib/gis/tests/geoapp/tests.py

    r5881 r6243  
    257257        self.assertEqual('Lawrence', City.objects.get(point__relate=(ks.poly, 'T********')).name) 
    258258 
     259    def test16_createnull(self): 
     260        "Testing creating a model instance and the geometry being None" 
     261        c = City() 
     262        self.assertEqual(c.point, None) 
     263 
    259264def suite(): 
    260265    s = unittest.TestSuite()