S
S
Sergey Nizhny Novgorod2016-06-18 02:21:48
Django
Sergey Nizhny Novgorod, 2016-06-18 02:21:48

How to remove "Required field" from Django form?

Hello.
You need to create a form with a required field, but at the same time you need to remove the auxiliary text from the top of the form:
download?id=XqP9z8PkJvO3Nc9owWKft882Pj5d
How can this be done?
The form itself:

class CreviewForm(forms.Form):
    review = forms.CharField(widget=forms.Textarea, label='Ваш отзыв', required=True)

Answer the question

In order to leave comments, you need to log in

4 answer(s)
P
Pan Propan, 2016-06-18
@mgis

Try this, add to forms.py

help_texts = {
            'review ': ' ',
        }

M
Michael, 2017-02-25
@DJWOMS1

error_messages={'required': ''} add to field

cen = forms.CharField(label = "", error_messages={'required': ''})

E
Evgeniya, 2019-03-26
@Premisse

it is also likely that when the form is displayed in the template, it is specified directly: {{ form.email.errors }} - it also displays
only the output of the field through {{ form.email }}

E
Ewan Pottermann, 2022-01-25
@Potterman

required=False

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question