Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何从选定的行间隔从 db 获取行?例如:1. 2. 3. 4. 5. 6. 7.
如何告诉 django 返回从 3 到 6 的行?
您可以使用与列表类似的切片语法:
YourModel.objects.order_by('column_name')[2:6]
查询集接受被翻译成 LIMIT/OFFSET 的列表切片语法。
MyModel.objects.all()[3:6]