1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-21 09:58:23 +02:00

Fix formatting issues

This commit is contained in:
Alexandre Iooss
2020-02-18 21:14:29 +01:00
parent cd98f96cd0
commit e679a4b629
16 changed files with 63 additions and 72 deletions

View File

@ -1,4 +1,3 @@
#!/usr/bin/env python
import django_tables2 as tables
from django.db.models import F
@ -15,11 +14,10 @@ class HistoryTable(tables.Table):
template_name = 'django_tables2/bootstrap.html'
sequence = ('...', 'total', 'valid')
total = tables.Column() #will use Transaction.total() !!
total = tables.Column() # will use Transaction.total() !!
def order_total(self, QuerySet, is_descending):
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)
queryset = queryset.annotate(total=F('amount') * F('quantity')) \
.order_by(('-' if is_descending else '') + 'total')
return (queryset, True)