diff --git a/users/forms.py b/users/forms.py index 8c6f5db9..8793a4c6 100644 --- a/users/forms.py +++ b/users/forms.py @@ -340,7 +340,10 @@ class AdherentForm(FormRevMixin, FieldPermissionFormMixin, ModelForm): """On supprime l'ancien user de la chambre si et seulement si la case est cochée""" if self.cleaned_data.get('force', False): - remove_user_room(self.cleaned_data.get('room')) + room = self.cleaned_data.get('room') + if room is None: + raise forms.ValidationError("Invalid Room") + remove_user_room(room) return