diff --git a/gym/admin.py b/gym/admin.py index 5e0ff2d..644eda5 100644 --- a/gym/admin.py +++ b/gym/admin.py @@ -5,27 +5,37 @@ from gym.models import Room, Equipment, TheoreticalMax, Session, Round, Unit, Wo @admin.register(Room) class RoomAdmin(admin.ModelAdmin): - pass + list_display = ['name'] @admin.register(Equipment) class EquipmentAdmin(admin.ModelAdmin): - pass + list_display = ['name', 'room', 'unit', 'last_theoretical_max', 'default_work_form', 'default_repetition_number'] + list_editable = ['default_work_form', 'default_repetition_number'] + list_filter = ['room', 'unit', 'default_work_form'] @admin.register(TheoreticalMax) class TheoreticalMaxAdmin(admin.ModelAdmin): - pass + list_display = ['equipment', 'date', 'value'] + list_display_links = ['equipment', 'date'] + list_filter = ['equipment'] + date_hierarchy = 'date' @admin.register(Session) class SessionAdmin(admin.ModelAdmin): - pass + list_display = ['start', 'room', 'default_theoretical_max_percentage'] + list_filter = ['room'] + date_hierarchy = 'start' @admin.register(Round) class RoundAdmin(admin.ModelAdmin): - pass + list_display = ['equipment', 'session', 'repetition_number', 'theoretical_max_percentage', 'chosen_weight', 'work_form'] + list_display_links = ['equipment', 'session'] + list_filter = ['equipment', 'work_form'] + date_hierarchy = 'session__start' @admin.register(Unit) diff --git a/gym/models.py b/gym/models.py index e073a9e..d59c383 100644 --- a/gym/models.py +++ b/gym/models.py @@ -106,7 +106,7 @@ class TheoreticalMax(models.Model): value = models.FloatField('valeur') def __str__(self): - return f'{self.value} {self.equipment.unit.name} le {self.date}' + return f'{self.value} {self.equipment.unit.name} le {self.date:%d/%m/%Y}' class Session(models.Model): @@ -127,10 +127,8 @@ class Session(models.Model): def __str__(self): import pytz - print(self.start) server_timezone = pytz.timezone(settings.TIME_ZONE) server = server_timezone.normalize(self.start.astimezone(server_timezone)) - print(server) return f'{self.room} {server:%d/%m/%Y %H:%M} ({settings.TIME_ZONE})'