Reputation: 1774
I wonder how you could do this... Normally,
DjangoObject.objects.all()[:10]
gives you limit of 10 data from the latest (if ordering is done in Model layer by recent date)
However, what I want to do is like (below is just an example, not valid Django Syntax):
DjangoObject.objects.filter(fromId=primaryKey)[:10]
So, here I want to get 10 data from a specific starting point. All I want here is to get 10 data in the middle of the list. Is there an easy way to do this?
I am using MongoDB as data source, so the primary is not incremental.
Upvotes: 2
Views: 1459
Reputation: 2520
I think this is what you want:
In [1]: from foo.models import Foo
In [2]: Foo.objects.filter(pk__gt=10)
Out[2]: []
pk means "Primary Key" and gt means "greater than". You can find it documented here:
Upvotes: 5