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,8 +56,9 @@ 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>
|
||||
"""
|
||||
|
||||
|
@ -99,14 +100,14 @@ class ButtonTable(tables.Table):
|
|||
|
||||
edit = tables.LinkColumn('note:template_update',
|
||||
args=[A('pk')],
|
||||
attrs={
|
||||
'td': {'class': 'col-sm-1'},
|
||||
attrs={'td': {'class': 'col-sm-1'},
|
||||
'a': {'class': 'btn btn-primary'}},
|
||||
text=_('edit'), accessor='pk')
|
||||
text=_('edit'),
|
||||
accessor='pk')
|
||||
|
||||
delete = tables.TemplateColumn(template_code=delete_template,
|
||||
extra_context={"delete_trans":_('delete')},
|
||||
attrs={'td':{'class':'col-sm-1'}})
|
||||
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,14 +14,16 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-10 card shadow">
|
||||
<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" id="buttons_table">
|
||||
<div class="card-body px-0 py-0" id="buttons_table">
|
||||
{% render_table table %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
|
Loading…
Reference in New Issue