I want to filter for Django objects such that their "id modulo K == N" .
Here's a way to do it in python, but I want it in the filter():
for foo in Foo.objects.all():
if foo.id % K == N:
print foo
So, I can use extra() with a query like this (please correct me if I'm wrong):
Foo.objects.extra(where['id %% %s = %s' % (K,N)])
But is there a way to use F()?
Django supports the use of addition, subtraction, multiplication, division and modulo arithmetic with F() objects
Note: this is very wrong:
Foo.objects.filter(id=F('id') % K)
I would need something like:
Foo.objects.filter(id__mod(K)=N)