Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
158 views
in Technique[技术] by (71.8m points)

python - Two Widgets in one form in same fields are not adding

I have build a BlogApp and I am working on Forms. BUT I want to add two Widgets in One Form and Both widgets are for one same Field.

forms.py

class EditBlogPost(forms.ModelForm):

    class Meta:
        model = BlogPost
        fields = ['title']
        widgets = {'title':forms.TextInput(attrs={'placeholder': 'e.g. For Painting, For Sculpting'})}
        widgets = {'title' : forms.Textarea(attrs={'cols':30})}

The Problem

When I put TextInput widget right below fields instance then TextInput widget works in Browser page but Textarea doesn't work AND when I put Textarea widget below fields instance then Textarea works and TextInput doesn't work. BUT I want them to run both at same time.

I don't know what to do.

Any help would be Appreciated.

Thank You in Advance

question from:https://stackoverflow.com/questions/65868255/two-widgets-in-one-form-in-same-fields-are-not-adding

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...