mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-11 04:19:25 +00:00
eboutic big refactor
This commit is contained in:
@ -19,9 +19,20 @@ from eboutic.models import *
|
||||
|
||||
@admin.register(Basket)
|
||||
class BasketAdmin(admin.ModelAdmin):
|
||||
list_display = ("user", "date", "get_total")
|
||||
list_display = ("user", "date", "total")
|
||||
autocomplete_fields = ("user",)
|
||||
|
||||
def get_queryset(self, request):
|
||||
return (
|
||||
super()
|
||||
.get_queryset(request)
|
||||
.annotate(
|
||||
total=Sum(
|
||||
F("items__quantity") * F("items__product_unit_price"), default=0
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@admin.register(BasketItem)
|
||||
class BasketItemAdmin(admin.ModelAdmin):
|
||||
|
Reference in New Issue
Block a user