Set unon authenticated user to NONE

This commit is contained in:
PCoder 2019-07-01 23:11:14 +05:30
parent 670c2b18a9
commit 32de20aaba

View file

@ -222,7 +222,7 @@ class UserHostingKeyForm(forms.ModelForm):
return self.data.get('name')
def clean_user(self):
return self.request.user
return self.request.user if self.request.user.is_authenticated() else None
def clean(self):
cleaned_data = self.cleaned_data