I have a class with a GeometryCollectionField, when I try to save a MultiPolygon object in the GeometryCollectionField I always get a NULL value in the GeometryCollectionField. Other types of objects saved in the GeometryCollectionField work fine. Somebody knows whats happening?
from django.contrib.gis.db import models class gcol(models.Model): name = models.CharField(max_length=50) geom = models.GeometryCollectionField() objects = models.GeoManager() from gcollection.models import gcol from django.contrib.gis.geos import GeometryCollection, MultiPolygon, Polygon p1 = Polygon( ((0, 0), (0, 1), (1, 1), (0, 0)) ) p2 = Polygon( ((1, 1), (1, 2), (2, 2), (1, 1)) ) mp = MultiPolygon(p1,p2) a=gcol.objects.get(name='a') a.geom=GeometryCollection((p1, p2)) a.save() a.geom=GeometryCollection(mp) a.save() /usr/lib64/python2.7/site-packages/django/db/backends/sqlite3/base.py in execute(self, query, params) 198 query = self.convert_query(query) 199 try: --> 200 return Database.Cursor.execute(self, query, params) 201 except Database.IntegrityError, e: 202 raise utils.IntegrityError, utils.IntegrityError(*tuple(e)), sys.exc_info()[2] IntegrityError: gcollection_gcol.geom may not be NULL -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.