5 | | This **actually** came up due to a Model having no {{{Meta.ordering}}}, which is our standard. All ordering must be explicit at the query level. |
| 5 | The actual issue was a Model having no {{{Meta.ordering}}}. Since both cause the issue, and we require `order_by()` to be explicit at the query level, I used the `.order_by()` example. The following will also fail, as the products model has no default ordering: |
| 6 | |
| 7 | {{{ |
| 8 | short_list = Prefetch( |
| 9 | "products", |
| 10 | queryset=Product.objects.all()[:10], |
| 11 | to_attr="short_list", |
| 12 | ) |
| 13 | class Product(models.Model): |
| 14 | class Meta: |
| 15 | # ordering = ['name'] |
| 16 | verbose_name_plural = "Products" |
| 17 | }}} |