Tuesday, January 12, 2010

SQL modulus using QuerySet API

I have a model that has an IntegerField. I'd like to filter only the
even integers. sqlite has a modulus operator so I can do:

select * from mytable where my_int = my_int % 2

However, I'd like to use the QuerySet API to do this instead of
resorting to SQL. Any ideas or hints?

Thanks,

Ryan

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate