From 48e5ec1ca38647922cfe011205198323b5c13842 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Thu, 24 Dec 2020 15:31:43 -0500 Subject: [PATCH] Don't allow non-staff users to impersonate other users in event form --- tasks/forms.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tasks/forms.py b/tasks/forms.py index 99f1fe3..eef1f93 100644 --- a/tasks/forms.py +++ b/tasks/forms.py @@ -15,3 +15,6 @@ class EventForm(forms.ModelForm): self.fields['date'].initial = datetime.now() self.fields['user'].initial = user + if not user.is_staff: + print(list(self.fields['user'].choices)) + self.fields['user'].choices = [(user.id, user)]