From c1ceb5e2b3ec52870ea0727ef158564edde47556 Mon Sep 17 00:00:00 2001 From: Hugo LEVY-FALK Date: Mon, 14 May 2018 23:16:36 +0200 Subject: [PATCH] =?UTF-8?q?fix=20de=20l'emm=C3=A9nagement=20forc=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- users/forms.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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