mirror of https://gitlab.crans.org/bde/nk20
make the CI pass and nicer front
This commit is contained in:
parent
20ea017e96
commit
0411646ae6
|
@ -56,11 +56,12 @@ class HistoryTable(tables.Table):
|
|||
def render_valid(self, value):
|
||||
return "✔" if value else "✖"
|
||||
|
||||
|
||||
# function delete_button(id) provided in template file
|
||||
delete_template = """
|
||||
DELETE_TEMPLATE = """
|
||||
<button id="{{ record.pk }}" class="btn btn-danger" onclick="delete_button(this.id)"> {{ delete_trans }}</button>
|
||||
"""
|
||||
|
||||
|
||||
class AliasTable(tables.Table):
|
||||
class Meta:
|
||||
attrs = {
|
||||
|
@ -75,7 +76,7 @@ class AliasTable(tables.Table):
|
|||
name = tables.Column(attrs={'td': {'class': 'text-center'}})
|
||||
# delete = tables.TemplateColumn(template_code=delete_template,
|
||||
# attrs={'td':{'class': 'col-sm-1'}})
|
||||
|
||||
|
||||
delete = tables.LinkColumn('member:user_alias_delete',
|
||||
args=[A('pk')],
|
||||
attrs={
|
||||
|
@ -97,16 +98,16 @@ class ButtonTable(tables.Table):
|
|||
|
||||
model = TransactionTemplate
|
||||
|
||||
edit = tables.LinkColumn('note:template_update',
|
||||
args=[A('pk')],
|
||||
attrs={
|
||||
'td': {'class': 'col-sm-1'},
|
||||
'a': {'class': 'btn btn-primary'}},
|
||||
text=_('edit'), accessor='pk')
|
||||
|
||||
delete = tables.TemplateColumn(template_code=delete_template,
|
||||
extra_context={"delete_trans":_('delete')},
|
||||
attrs={'td':{'class':'col-sm-1'}})
|
||||
|
||||
edit = tables.LinkColumn('note:template_update',
|
||||
args=[A('pk')],
|
||||
attrs={'td': {'class': 'col-sm-1'},
|
||||
'a': {'class': 'btn btn-primary'}},
|
||||
text=_('edit'),
|
||||
accessor='pk')
|
||||
|
||||
delete = tables.TemplateColumn(template_code=DELETE_TEMPLATE,
|
||||
extra_context={"delete_trans": _('delete')},
|
||||
attrs={'td': {'class': 'col-sm-1'}})
|
||||
|
||||
def render_amount(self, value):
|
||||
return pretty_money(value)
|
||||
|
|
|
@ -111,6 +111,7 @@ class TransactionTemplateCreateView(LoginRequiredMixin, CreateView):
|
|||
form_class = TransactionTemplateForm
|
||||
success_url = reverse_lazy('note:template_list')
|
||||
|
||||
|
||||
class TransactionTemplateListView(LoginRequiredMixin, SingleTableView):
|
||||
"""
|
||||
List TransactionsTemplates
|
||||
|
@ -118,14 +119,6 @@ class TransactionTemplateListView(LoginRequiredMixin, SingleTableView):
|
|||
model = TransactionTemplate
|
||||
table_class = ButtonTable
|
||||
|
||||
def get_queryset(self):
|
||||
name = self.request.GET.get('name','')
|
||||
if (name != ''):
|
||||
object_list = self.model.objects.filter(name__icontains = name)
|
||||
else:
|
||||
object_list = self.model.objects.all()
|
||||
return object_list
|
||||
|
||||
|
||||
class TransactionTemplateUpdateView(LoginRequiredMixin, UpdateView):
|
||||
"""
|
||||
|
@ -134,6 +127,7 @@ class TransactionTemplateUpdateView(LoginRequiredMixin, UpdateView):
|
|||
form_class = TransactionTemplateForm
|
||||
success_url = reverse_lazy('note:template_list')
|
||||
|
||||
|
||||
class ConsoView(LoginRequiredMixin, SingleTableView):
|
||||
"""
|
||||
The Magic View that make people pay their beer and burgers.
|
||||
|
|
|
@ -14,12 +14,14 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-10 card shadow">
|
||||
<div class="card-header text-center">
|
||||
<h5> {% trans "buttons listing "%}</h5>
|
||||
</div>
|
||||
<div class="card" id="buttons_table">
|
||||
{% render_table table %}
|
||||
<div class="col-md-10">
|
||||
<div class="card card-border shadow">
|
||||
<div class="card-header text-center">
|
||||
<h5> {% trans "buttons listing "%}</h5>
|
||||
</div>
|
||||
<div class="card-body px-0 py-0" id="buttons_table">
|
||||
{% render_table table %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue