8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 07:23:46 +00:00

Fix side effect when importing multi_op

This commit is contained in:
Hugo Levy-Falk 2020-12-30 18:23:55 +01:00 committed by chirac
parent 2f2566ac64
commit 4ec4763d1c

View file

@ -36,15 +36,17 @@ from topologie.models import Dormitory
from .preferences.models import MultiopOption from .preferences.models import MultiopOption
class DormitoryForm(FormRevMixin, Form): class DormitoryForm(FormRevMixin, Form):
"""Form used to select dormitories.""" """Form used to select dormitories."""
dormitory = forms.ModelMultipleChoiceField( dormitory = forms.ModelMultipleChoiceField(
queryset=MultiopOption.get_cached_value("enabled_dorm").all(),
label=_("Dormitory"), label=_("Dormitory"),
widget=forms.CheckboxSelectMultiple, widget=forms.CheckboxSelectMultiple,
required=False, required=False,
queryset=Dormitory.objects.none(),
) )
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(DormitoryForm, self).__init__(*args, **kwargs) super(DormitoryForm, self).__init__(*args, **kwargs)
self.fields["dormitory"].queryset = MultiopOption.get_cached_value("enabled_dorm").all()