📜  django get part of queryset - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:36.215000             🧑  作者: Mango

代码示例1
# According to documentation

# Limiting QuerySets
# This is the equivalent of SQL’s LIMIT and OFFSET clauses.

# For example, this returns the first 5 objects (LIMIT 5):
>>> Entry.objects.all()[:5]

# This returns the sixth through tenth objects (OFFSET 5 LIMIT 5):
>>> Entry.objects.all()[5:10]