1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-07-20 08:01:26 +02:00

Add fee field to WEIRegistration to be able to sort on validation status

This commit is contained in:
Ehouarn
2025-07-19 16:24:25 +02:00
parent b1fa1c2cdd
commit edb6abfff5
6 changed files with 131 additions and 17 deletions

View File

@ -56,10 +56,13 @@ class WEIRegistrationTable(tables.Table):
}
)
validate = tables.Column(
validate = tables.LinkColumn(
'wei:wei_update_registration',
args=[A('pk')],
verbose_name=_("Validate"),
orderable=False,
accessor=A('pk'),
orderable=True,
accessor='validate_status',
text=_("Validate"),
attrs={
'th': {
'id': 'validate-membership-header'
@ -100,10 +103,11 @@ class WEIRegistrationTable(tables.Table):
url = reverse_lazy('wei:wei_update_registration', args=(record.pk,)) + '?validate=true'
text = _('Validate')
if record.fee > record.user.note.balance and not record.soge_credit:
status = record.validation_status
if status == 2:
btn_class = 'btn-secondary'
tooltip = _("The user does not have enough money.")
elif record.first_year:
elif status == 1:
btn_class = 'btn-info'
tooltip = _("The user is in first year. You may validate the credit, the algorithm will run later.")
else:
@ -121,6 +125,7 @@ class WEIRegistrationTable(tables.Table):
attrs = {
'class': 'table table-condensed table-striped table-hover'
}
order_by = ('validate', 'user',)
model = WEIRegistration
template_name = 'django_tables2/bootstrap4.html'
fields = ('user', 'user__first_name', 'user__last_name', 'first_year', 'deposit_check',