summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikaël Ates <mates@entrouvert.com>2014-10-07 15:06:44 (GMT)
committerMikaël Ates <mates@entrouvert.com>2014-10-07 15:06:44 (GMT)
commit01e321c7606d3f1af69da34b9da492618bffdca1 (patch)
tree54af71f54951c763a090891d1ebed219f16440be
parent0c97658eab777fcb6610a29f4afd2e910242f6f2 (diff)
downloadcalebasse-01e321c7606d3f1af69da34b9da492618bffdca1.zip
calebasse-01e321c7606d3f1af69da34b9da492618bffdca1.tar.gz
calebasse-01e321c7606d3f1af69da34b9da492618bffdca1.tar.bz2
personnes: allow userworker removing of an access.
-rw-r--r--calebasse/personnes/forms.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/calebasse/personnes/forms.py b/calebasse/personnes/forms.py
index 1b73365..44f6c3e 100644
--- a/calebasse/personnes/forms.py
+++ b/calebasse/personnes/forms.py
@@ -80,6 +80,11 @@ class UserForm(forms.ModelForm):
else:
UserWorker.objects.create(user=instance, worker=worker)
self.save_m2m = save_m2m
+ else:
+ try:
+ instance.userworker.delete()
+ except UserWorker.DoesNotExist:
+ pass
if instance.pk:
instance.groups = self.cleaned_data['groups']
if commit: