8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 15:33:45 +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 Gabriel Detraz
parent 681d7f10b2
commit deccc437d5

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()