mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-11-26 18:37:12 +00:00
History tables are not orderable
This commit is contained in:
parent
eaf256b1b6
commit
1977e403e3
@ -4,7 +4,6 @@
|
|||||||
import html
|
import html
|
||||||
|
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
from django.db.models import F
|
|
||||||
from django.utils.html import format_html
|
from django.utils.html import format_html
|
||||||
from django_tables2.utils import A
|
from django_tables2.utils import A
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
@ -76,12 +75,6 @@ class HistoryTable(tables.Table):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
def order_total(self, queryset, is_descending):
|
|
||||||
# needed for rendering
|
|
||||||
queryset = queryset.annotate(total=F('amount') * F('quantity')) \
|
|
||||||
.order_by(('-' if is_descending else '') + 'total')
|
|
||||||
return queryset, True
|
|
||||||
|
|
||||||
def render_amount(self, value):
|
def render_amount(self, value):
|
||||||
return pretty_money(value)
|
return pretty_money(value)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user