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

Add view for aliases

This commit is contained in:
Pierre-antoine Comby
2020-02-28 13:37:31 +01:00
parent f1cedc902e
commit f77351b444
6 changed files with 121 additions and 3 deletions

View File

@ -6,6 +6,12 @@ from django import forms
from django.utils.translation import gettext_lazy as _
from .models import Transaction, TransactionTemplate, TemplateTransaction
from .models import Alias
class AliasForm(forms.ModelForm):
class Meta:
model = Alias
fields = ("name",)
class TransactionTemplateForm(forms.ModelForm):

View File

@ -5,7 +5,7 @@ import django_tables2 as tables
from django.db.models import F
from .models.transactions import Transaction
from .models.notes import Alias
class HistoryTable(tables.Table):
class Meta:
@ -24,3 +24,16 @@ class HistoryTable(tables.Table):
queryset = queryset.annotate(total=F('amount') * F('quantity')) \
.order_by(('-' if is_descending else '') + 'total')
return (queryset, True)
class AliasTable(tables.Table):
class Meta:
attrs = {
'class':
'table table condensed table-striped table-hover'
}
model = Alias
fields = ('name',)
template_name = 'django_tables2/bootstrap4.html'
delete = tables.LinkColumn('member:user_alias_delete', args=[A('id')], attrs={
'a': {'class': 'btn'} })