Wednesday, January 30, 2013

Special SELECT and UPDATE for a field

i want to create a field class for geometry (not using geodjango).
here's the field code:

i want 2 things i can't seem to do:
1. I want the select to wrap the column with MySql AsText() Function
e.x. SELECT AsText(location) FROM addresses

2. I want to be able to save the value wrapped with a function e.x. GeomFromText('POINT(0.0 0.0)')
but is seems that django will wrap that function with quotes, and so mysql thinks its a string.

I found that in order to fix these, i will have to write an SQLCompiler, Query, QuerySet, QuerySetManager. (or modify the get_columns and get_default_columns methods of the SQLCompiler)
I am sure there is a simpler way.

What can I do?


You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment