use .get because it might not be there.

This commit is contained in:
Víðir Valberg Guðmundsson 2018-08-19 00:06:25 +02:00
parent b50f368dea
commit 014e962a3f
1 changed files with 1 additions and 1 deletions

View File

@ -182,7 +182,7 @@ class EventProposalForm(forms.ModelForm):
self.instance.user = user
self.instance.event_type = event_type
super().save(commit=True)
if self.cleaned_data['slides_url'] and (self.instance.event_type.name == 'Talk' or self.instance.event_type.name == 'Lightning Talk'):
if self.cleaned_data.get('slides_url') and (self.instance.event_type.name == 'Talk' or self.instance.event_type.name == 'Lightning Talk'):
slides_url = Url()
slides_url.eventproposal = self.instance
slides_url.url = self.cleaned_data['slides_url']