From afda2c2b0368904721a933b23df03481ad0ee9e5 Mon Sep 17 00:00:00 2001 From: bashmak Date: Tue, 26 Jun 2018 18:38:54 +0300 Subject: [PATCH] Fix --- devapp/forms.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/devapp/forms.py b/devapp/forms.py index 4496900..a023b8a 100644 --- a/devapp/forms.py +++ b/devapp/forms.py @@ -15,8 +15,11 @@ class DeviceForm(forms.ModelForm): Move comment from value to placeholder in HTML form """ initial = kwargs.get('initial') - comment = initial.get('comment') - del initial['comment'] + if initial: + comment = initial.get('comment') + del initial['comment'] + else: + comment = None super(DeviceForm, self).__init__(*args, **kwargs) self.fields['comment'].widget.attrs['placeholder'] = comment