I'm playing with creating a custom django field to store a point. I'm
using PostGIS.
The point is stored as a tuple, and in my field object I have
def pre_save(self, model_instance, add):
value = getattr(model_instance, self.attname)
return r"GeomFromText('Point(%f, %f)', 8307)" % value
When I try to create an object with a point, like so:
l=Location(name='test', point=(34.790556, 49.945556))
it tries to quote everything, and postgres doesn't like it:
ProgrammingError: ERROR: parse error - invalid geometry
INSERT INTO "geom_location" ("name","point") VALUES
('test','GeomFromText(''Point(34.790556, 49.945556)'', 8307)')
is there a simple way I can avoid having my text quoted?
Thanks
--B
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---