You can see in my paste that i already created a custom field for geometry field.
On Thu, Jan 31, 2013 at 7:52 PM, Tom Evans <tevans.uk@googlemail.com> wrote:
On Wed, Jan 30, 2013 at 8:14 PM, Yarden Sachs <yarden@tapingo.com> wrote:
> Hello,
> i want to create a field class for geometry (not using geodjango).
> here's the field code: http://pastebin.com/yADpZykJ
>
> 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?
>
> Thanks!
Sounds like you want to define a custom field rather than fiddle with
a Model's manager.
https://docs.djangoproject.com/en/1.4/howto/custom-model-fields/
Cheers
Tom
--
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment