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

Merge branch 'fix-multi-op-side-effect' into 'dev'

Fix side effect when importing multi_op

See merge request re2o/re2o!581
This commit is contained in:
chirac 2020-12-30 18:24:42 +01:00
commit 01384ce296

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