mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-30 03:51:10 +02:00
Move apps in main directory
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
31
registration/tables.py
Normal file
31
registration/tables.py
Normal file
@ -0,0 +1,31 @@
|
||||
# Copyright (C) 2020 by Animath
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
import django_tables2 as tables
|
||||
|
||||
from .models import Registration
|
||||
|
||||
|
||||
class RegistrationTable(tables.Table):
|
||||
"""
|
||||
Table of all registrations.
|
||||
"""
|
||||
last_name = tables.LinkColumn(
|
||||
'registration:user_detail',
|
||||
args=[tables.A("user_id")],
|
||||
verbose_name=lambda: _("last name").capitalize(),
|
||||
accessor="user__last_name",
|
||||
)
|
||||
|
||||
def order_type(self, queryset, desc):
|
||||
types = ["volunteerregistration", "-volunteerregistration__admin", "participantregistration"]
|
||||
return queryset.order_by(*(("-" if desc else "") + t for t in types)), True
|
||||
|
||||
class Meta:
|
||||
attrs = {
|
||||
'class': 'table table-condensed table-striped',
|
||||
}
|
||||
model = Registration
|
||||
fields = ('last_name', 'user__first_name', 'user__email', 'type',)
|
||||
order_by = ('type', 'last_name', 'first_name',)
|
Reference in New Issue
Block a user