mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-12-22 23:42:25 +00:00
Add Bus information in the WEI survey "api"
This commit is contained in:
parent
cdff0d3893
commit
705313edb6
@ -36,6 +36,16 @@ class WEISurveyInformation:
|
||||
registration.information = self.__dict__
|
||||
|
||||
|
||||
class WEIBusInformation:
|
||||
"""
|
||||
Abstract data of the bus.
|
||||
"""
|
||||
|
||||
def __init__(self, bus: Bus):
|
||||
self.__dict__.update(bus.information)
|
||||
self.bus = bus
|
||||
|
||||
|
||||
class WEISurveyAlgorithm:
|
||||
"""
|
||||
Abstract algorithm that attributes a bus to each new member.
|
||||
@ -48,6 +58,14 @@ class WEISurveyAlgorithm:
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@classmethod
|
||||
def get_bus_information_class(cls):
|
||||
"""
|
||||
The class of the information associated to a bus extending WEIBusInformation.
|
||||
Default: WEIBusInformation (contains nothing)
|
||||
"""
|
||||
return WEIBusInformation
|
||||
|
||||
@classmethod
|
||||
def get_registrations(cls) -> QuerySet:
|
||||
"""
|
||||
@ -62,6 +80,13 @@ class WEISurveyAlgorithm:
|
||||
"""
|
||||
return Bus.objects.filter(wei__year=cls.get_survey_class().get_year())
|
||||
|
||||
@classmethod
|
||||
def get_bus_information(cls, bus):
|
||||
"""
|
||||
Return the WEIBusInformation object containing the data stored in a given bus.
|
||||
"""
|
||||
return cls.get_bus_information_class()(bus)
|
||||
|
||||
def run_algorithm(self) -> None:
|
||||
"""
|
||||
Once this method implemented, run the algorithm that attributes a bus to each first year member.
|
||||
|
@ -516,6 +516,7 @@ class WEIRegister2AView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
|
||||
form.fields["soge_credit"].disabled = True
|
||||
form.fields["soge_credit"].help_text = _("You already opened an account in the Société générale.")
|
||||
|
||||
del form.fields["caution_check"]
|
||||
del form.fields["first_year"]
|
||||
del form.fields["ml_events_registration"]
|
||||
del form.fields["ml_art_registration"]
|
||||
|
Loading…
Reference in New Issue
Block a user