Thats pretty cool, I didnt know you could do create function. Will check this out later :) On 11 Jul 2011 06:06, "Venkatraman S" <venka...@gmail.com> wrote: > On Mon, Jul 11, 2011 at 10:02 AM, sanket <sanket.s.pa...@gmail.com> wrote: > >> I think I would go ahead with executing the raw SQL in this case. >> The solution by @Venatraman looks interesting too. I would give it a >> try. >> > > Raw-sql and the snippet provided by me would end up generating the same sql. > > One advantage of my snippet is, if your db does not support sin/cos > functions(like sqlite3), > then you can go ahead defining funcs which computes the same. Something > like.. > from django.db import connection, transaction > cursor = connection.cursor() > import math > connection.connection.create_function('acos', 1, > math.acos) > connection.connection.create_function('cos', 1, > math.cos) > connection.connection.create_function('sin', 1, > math.sin) > > -V > > -- > You received this message because you are subscribed to the Google Groups "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/django-users?hl=en. >
-- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.