Re: need help with calling following complex query

2011-07-11 Thread Roshan Mathews
On Mon, Jul 11, 2011 at 10:36, Venkatraman S  wrote:
> 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)
>

Nice! Didn't know this could be done. Thanks for the update.

--
http://about.me/rosh

-- 
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.



Re: CSRF token not adding hidden form field

2010-06-10 Thread Roshan Mathews
On Thu, Jun 10, 2010 at 11:45, joelklabo  wrote:
> Looks like it did something, I didn't get a 403 but I got this error:
>
Okay, so it seems, 'django.middleware.csrf.CsrfResponseMiddleware' is
not required.  Please remove that.

Are your forms working without csrf protection turned on?  That stack
trace looks like it couldn't resolve some url, and given that your
form is not posting to the same view it came from, that might be a
source of the problem.  Check your urls.py ...

-- 
http://roshan.mathews.in/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Re: CSRF token not adding hidden form field

2010-06-10 Thread Roshan Mathews
On Thu, Jun 10, 2010 at 11:08, joelklabo  wrote:
> MIDDLEWARE_CLASSES = (
>    'django.middleware.common.CommonMiddleware',
>    'django.contrib.sessions.middleware.SessionMiddleware',
>    'django.middleware.csrf.CsrfViewMiddleware',
>    'django.contrib.auth.middleware.AuthenticationMiddleware',
>    'django.contrib.messages.middleware.MessageMiddleware',
> )
>

Can you add 'django.middleware.csrf.CsrfResponseMiddleware',
after CsrfViewMiddleware above?

The docs [1] say that this is only required in the legacy method, but
{% csrf_token %} doesn't work for me without the
CsrfResponseMiddleware.  Dunno if something is broken somewhere or did
I misread the steps involved.

The docs also say "Use of the CsrfResponseMiddleware  is not
recommended ..." so it would be nice if someone else can fix your
problem, but can you please try this and see if it works?

[1] http://docs.djangoproject.com/en/dev/ref/contrib/csrf/

-- 
http://roshan.mathews.in/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Re: Django Send Mail

2010-06-09 Thread Roshan Mathews
On Thu, Jun 10, 2010 at 09:58, Sudharshan  wrote:
> SMTPDataError: (550, 'Please use SMTP authentication or check your
> POP3 mail before attempting to\nsend mail.')
>
Given that error, maybe this will help,
http://en.wikipedia.org/wiki/POP_before_SMTP

-- 
http://roshan.mathews.in/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.