0
나는 변형 된 피라미드를 시험 중이다. 그러나 양식은 양식으로 렌더링되지 않고 순수한 문자열입니다.변형이있는 피라미드가 제대로 렌더링되지 않습니다. 순수한 문자열로 렌더링
@view_config(route_name='sign_up', renderer='templates/sign_up.jinja2')
def sign_up(request):
schema = SignUpForm().bind(request=request)
button = deform.form.Button(name='SignUp', title = 'Sign Up')
form = deform.form.Form(schema, buttons=(button,))
if request.method == 'POST':
try:
appstruct = form.validate(request.POST.items())
# Save the data to database
print('saved')
print(appstruct['username'])
request.session.flash('your have succesfully registered')
return HTTPFound('/')
except deform.exception.ValidationFailure as e:
rendered_form = form.render()
else:
print('rendering the form')
rendered_form = form.render();
return {'rendered_form': rendered_form}
이것은 Jinja2 템플릿을 사용하는 제 HTML입니다.
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
{{rendered_form}}
</body>
</html>
모든 형태의 정보가
class SignUpForm(deform.schema.CSRFSchema):
username = colander.SchemaNode(
colander.String(),
title = 'Username')
password = colander.SchemaNode(
colander.String(),
title = 'Password')
완벽한 솔루션! 감사! – Bobby