Answer the question
In order to leave comments, you need to log in
How to remove Bad Request?
hello
there is a function
def post(self):
print(request.form)
#Если все необхоидмые поля заполнены
if request.form['name'] and request.form['lastname'] and request.form['email'] and request.form['password']:
#Если юзера с таким мылом в базе ещее нет
if email_exist(request.form['email']) == False:
#Создаем юзера
create_user(request.form)
#проверяем пришли ли чекбоксы и привзяваем их к юзеру в базе
#========================================================
if request.form['op1']:
fa_roles(request.form['email'], 1)
print('op1')
if request.form['op2']:
print('op2')
fa_roles(request.form['email'], 2)
if request.form['op3']:
fa_roles(request.form['email'], 3)
print('op3')
#============================================
return redirect(url_for('registration.regcomplete'))
else:
return render_template('registration.html', error='уже есть такое мыло')
else:
return render_template('registration.html', error= 'Заполни все поля')
return self.get()
#fa_roles
@db_session
def fa_roles(email, role):
user = User.get(email = email)
user.roles +=Roles.get(id = role)
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