Re: Modulo not working in query using extra() to define specific where

2009-11-30 Thread Marcos Marín
Yes that was the problem, thanks! On Mon, Nov 30, 2009 at 18:21, Craig Kimerer wrote: > No guarantees that this will fix the issue, but have you tried escaping the > '%'? > > Try `Semestre.objects.extra(where=['num %% 2 = 0'])` and this may give you > your desired

Re: Modulo not working in query using extra() to define specific where

2009-11-30 Thread Craig Kimerer
No guarantees that this will fix the issue, but have you tried escaping the '%'? Try `Semestre.objects.extra(where=['num %% 2 = 0'])` and this may give you your desired result. Looks like an issue with python string formatting. Alternatively, you could try `print

Modulo not working in query using extra() to define specific where

2009-11-30 Thread Marcos Marín
Hi, I'm trying to do a query where I select all rows where a field is divisible by 2. In pure SQL this is what I want: select * from contenido_semestre where num % 2 = 0; which works fine. When trying to do it with Django I do Semestre.objects.extra(where=['num % 2 = 0']) But this gets me an empty