Answer the question
In order to leave comments, you need to log in
How to do form validation in methodView?
Hello, let's say
@app.route('/', methods ={'GET','POST'])
def app():
form = Form()
if request.method =='POST' and form.validate_on_submit():
return redirect('блаблабла')
else:
return render_tamplate('in.html',form =form)
class One(MethodWiew):
def get(self):
# Зесь получам гед запрос и рендерим страницу с формой
form =FOrm()
return render template('in.html', form=form)
def post(self):
# а вот тут получаем запрос пост и если он не проходит валидацю то надо вернуть все то же что и в гет + ошибки валидаторров wtforms
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question