Closed manelclos closed 13 years ago
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.3-py2.6.egg/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.3-py2.6.egg/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.3-py2.6.egg/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.3-py2.6.egg/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.6/dist-packages/reversion/management/commands/createinitialrevisions.py", line 69, in handle
self.create_initial_revisions (app, model_class)
File "/usr/local/lib/python2.6/dist-packages/reversion/management/commands/createinitialrevisions.py", line 92, in create_initial_revisions
self.version_save(obj)
File "/usr/local/lib/python2.6/dist-packages/reversion/revisions.py", line 314, in _create_on_success
result = func(*args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/reversion/management/commands/createinitialrevisions.py", line 74, in version_save
obj.save()
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.3-py2.6.egg/django/db/models/base.py", line 434, in save
self.save_base(using=using, force_insert=force_insert, force_update=force_update)
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.3-py2.6.egg/django/db/models/base.py", line 499, in save_base
values = [(f, None, (raw and getattr(self, f.attname) or f.pre_save(self, False))) for f in non_pks]
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.3-py2.6.egg/django/db/models/fields/__init__.py", line 257, in pre_save
return getattr(model_instance, self.attname)
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.3-py2.6.egg/django/contrib/gis/db/models/proxy.py", line 39, in __get__
setattr(obj, self._field.attname, geom)
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.3-py2.6.egg/django/contrib/gis/db/models/proxy.py", line 60, in __set__
raise TypeError('cannot set %s GeometryProxy with value of type: %s' % (obj.__class__.__name__, type(value)))
TypeError: cannot set MyModel GeometryProxy with value of type: <class 'django.contrib.gis.geos.collections.MultiPolygon'>
When I try to change the model definition:
the_geom = models.MultiPolygonField(srid=23031, null=True, blank=True)
The error also switches:
TypeError: cannot set MyModel GeometryProxy with value of type: <class 'django.contrib.gis.geos.polygon.Polygon'>
I'm having trouble working out what's going on here, as I'm completely unfamiliar with GeoDjango.
Surely using the default manager is correct in this case. Reversion just iterates over all current models and calls their save() method. If this is crashing GeoDjango, surely something funny is going on?
I'm closing this issue for the time being. I don't really know what's going on, or what the problem is.
I'm trying to get reversion to work with geodjango. The first problem I found is that create_initial_revisions does not work:
The problem seems to be that it uses the default manager: createinitialrevisions.py:90 for obj in model_class._default_manager.iterator():
But in geodjango the manager is replaced for GeoManager: class MyModel(models.Model): the_geom = models.PolygonField(srid=23031, null=True, blank=True) objects = models.GeoManager()
Thanks in advance!