mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-10 11:59:23 +00:00
Make ProductType
an OrderedModel
This commit is contained in:
@ -36,7 +36,7 @@ def get_eboutic_products(user: User) -> list[Product]:
|
||||
.products.filter(product_type__isnull=False)
|
||||
.filter(archived=False)
|
||||
.filter(limit_age__lte=user.age)
|
||||
.annotate(priority=F("product_type__priority"))
|
||||
.annotate(order=F("product_type__order"))
|
||||
.annotate(category=F("product_type__name"))
|
||||
.annotate(category_comment=F("product_type__comment"))
|
||||
.prefetch_related("buying_groups") # <-- used in `Product.can_be_sold_to`
|
||||
|
@ -88,7 +88,7 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% for priority_groups in products|groupby('priority')|reverse %}
|
||||
{% for priority_groups in products|groupby('order') %}
|
||||
{% for category, items in priority_groups.list|groupby('category') %}
|
||||
{% if items|count > 0 %}
|
||||
<section>
|
||||
|
Reference in New Issue
Block a user