LayerMapping disregards model inheritance

3 views
Skip to first unread message

omat

unread,
Oct 27, 2009, 8:59:57 AM10/27/09
to geodjango
Hi,

With 2 models as such:

class Place(models.Model):
location = models.PointField()

class Hotel(Place):
name = models.DateTimeField()


While I can import into Place using LayerMapping, when I try to import
into Hotel:

mapping = {'name': 'name',
'location': 'POINT'}
LayerMapping(Hotel, ds, mapping)

I get a:

LayerMapError: Geometry column does not exist for model


As it looks like a bug, I created a ticket for this:
http://code.djangoproject.com/ticket/12093

But, with the hope of getting an advice for a quick fix, I am posting
it here too.


Thanks,
omat

Josh Livni

unread,
Oct 27, 2009, 1:21:13 PM10/27/09
to geod...@googlegroups.com
You put objects =  models.GeoManager() in your model, right?

 -Josh

omat

unread,
Oct 28, 2009, 5:45:12 AM10/28/09
to geodjango
Yes, but only into the base model, i.e. Place in the example.

omat

unread,
Oct 28, 2009, 6:36:47 AM10/28/09
to geodjango
Makes no difference if I put an extra
objects = models.GeoManager()
in the inherited model too.


--
omat

Justin Bronn

unread,
Nov 1, 2009, 9:27:27 PM11/1/09
to geod...@googlegroups.com
omat,

Thanks for reporting this as a bug in ticket #12093. I just committed
fixes to trunk and the 1.1.X branch in r11703 and r11704, respectively.

Best Regards,
-Justin

Reply all
Reply to author
Forward
0 new messages