mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-06-21 01:48:21 +02:00
happy new year (contain annually WEI change and update to follow Django Style Guide)
This commit is contained in:
18
apps/wei/migrations/0008_auto_20240111_1545.py
Normal file
18
apps/wei/migrations/0008_auto_20240111_1545.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 2.2.28 on 2024-01-11 14:45
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('wei', '0007_help_text_emergency_contact'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='weiclub',
|
||||
name='year',
|
||||
field=models.PositiveIntegerField(default=2024, unique=True, verbose_name='year'),
|
||||
),
|
||||
]
|
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2018-2023 by BDE ENS Paris-Saclay
|
||||
# Copyright (C) 2018-2024 by BDE ENS Paris-Saclay
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import json
|
||||
@ -33,6 +33,10 @@ class WEIClub(Club):
|
||||
verbose_name=_("date end"),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("WEI")
|
||||
verbose_name_plural = _("WEI")
|
||||
|
||||
@property
|
||||
def is_current_wei(self):
|
||||
"""
|
||||
@ -46,10 +50,6 @@ class WEIClub(Club):
|
||||
"""
|
||||
return
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("WEI")
|
||||
verbose_name_plural = _("WEI")
|
||||
|
||||
|
||||
class Bus(models.Model):
|
||||
"""
|
||||
@ -84,6 +84,14 @@ class Bus(models.Model):
|
||||
help_text=_("Information about the survey for new members, encoded in JSON"),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Bus")
|
||||
verbose_name_plural = _("Buses")
|
||||
unique_together = ('wei', 'name',)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
@property
|
||||
def information(self):
|
||||
"""
|
||||
@ -106,14 +114,6 @@ class Bus(models.Model):
|
||||
registrations = [r for r in registrations if 'selected_bus_pk' in r.information]
|
||||
return sum(1 for r in registrations if r.information['selected_bus_pk'] == self.pk)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Bus")
|
||||
verbose_name_plural = _("Buses")
|
||||
unique_together = ('wei', 'name',)
|
||||
|
||||
|
||||
class BusTeam(models.Model):
|
||||
"""
|
||||
@ -142,20 +142,19 @@ class BusTeam(models.Model):
|
||||
verbose_name=_("description"),
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return self.name + " (" + str(self.bus) + ")"
|
||||
|
||||
class Meta:
|
||||
unique_together = ('bus', 'name',)
|
||||
verbose_name = _("Bus team")
|
||||
verbose_name_plural = _("Bus teams")
|
||||
|
||||
def __str__(self):
|
||||
return self.name + " (" + str(self.bus) + ")"
|
||||
|
||||
|
||||
class WEIRole(Role):
|
||||
"""
|
||||
A Role for the WEI can be bus chief, team chief, free electron, ...
|
||||
"""
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("WEI Role")
|
||||
verbose_name_plural = _("WEI Roles")
|
||||
@ -165,7 +164,6 @@ class WEIRegistration(models.Model):
|
||||
"""
|
||||
Store personal data that can be useful for the WEI.
|
||||
"""
|
||||
|
||||
user = models.ForeignKey(
|
||||
User,
|
||||
on_delete=models.PROTECT,
|
||||
@ -258,6 +256,14 @@ class WEIRegistration(models.Model):
|
||||
"encoded in JSON"),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
unique_together = ('user', 'wei',)
|
||||
verbose_name = _("WEI User")
|
||||
verbose_name_plural = _("WEI Users")
|
||||
|
||||
def __str__(self):
|
||||
return str(self.user)
|
||||
|
||||
@property
|
||||
def information(self):
|
||||
"""
|
||||
@ -307,14 +313,6 @@ class WEIRegistration(models.Model):
|
||||
except AttributeError:
|
||||
return False
|
||||
|
||||
def __str__(self):
|
||||
return str(self.user)
|
||||
|
||||
class Meta:
|
||||
unique_together = ('user', 'wei',)
|
||||
verbose_name = _("WEI User")
|
||||
verbose_name_plural = _("WEI Users")
|
||||
|
||||
|
||||
class WEIMembership(Membership):
|
||||
bus = models.ForeignKey(
|
||||
|
Reference in New Issue
Block a user