From 07071c7cf91e87932a63ea6cc322a21b19b84796 Mon Sep 17 00:00:00 2001 From: Maxime Bombar Date: Tue, 10 Sep 2019 17:09:26 +0200 Subject: [PATCH] Fixes Issue 221 --- users/forms.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/users/forms.py b/users/forms.py index 16ab4652..747b4aff 100644 --- a/users/forms.py +++ b/users/forms.py @@ -371,8 +371,9 @@ class AdherentForm(FormRevMixin, FieldPermissionFormMixin, ModelForm): def clean_force(self): """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 self.cleaned_data.get('force', False) and room: + remove_user_room(room) return