Don't allow non-staff users to impersonate other users in event form

This commit is contained in:
Adam Goldsmith 2020-12-24 15:31:43 -05:00
parent e02ba33348
commit 48e5ec1ca3

View File

@ -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)]