From 6c61ce7840f9232bc6f37e2f5b6091389343ec2b Mon Sep 17 00:00:00 2001 From: Hugo LEVY-FALK Date: Tue, 15 May 2018 00:00:46 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20du=20forcer=20le=20d=C3=A9m=C3=A9nagement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- users/forms.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/users/forms.py b/users/forms.py index 8c6f5db9..67924962 100644 --- a/users/forms.py +++ b/users/forms.py @@ -340,7 +340,11 @@ 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