I am getting this error in Django 1.9
in PostForm
content = forms.CharField(widget=PagedownWidget(show_preview=False))
TypeError: __init__() got an unexpected keyword argument 'show_preview'
forms.py
class PostForm(forms.ModelForm):
content = forms.CharField(widget=PagedownWidget(show_preview=False))
publish = forms.DateField(widget=forms.SelectDateWidget)
class Meta:
model = Post
fields = [
"title",
"content",
"image",
"draft",
"publish",
]
The dependencies installed in the virtual environment $ pip freeze
certifi==2019.11.28
Django==1.9
django-crispy-forms==1.8.1
django-filter==2.2.0
django-markdown-deux==1.0.5
django-pagedown==2.0.3
djangorestframework==3.11.0
Markdown==3.1.1
markdown2==2.3.1
olefile==0.46
Pillow==6.2.1
Use attrs-- (Django Doc) parameter to pass the values to widget
widget=PagedownWidget(attrs={"show_preview":False})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With