Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksonwalters committed Mar 27, 2020
1 parent fa33b38 commit b7f5957
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 1 deletion.
Binary file removed __pycache__.zip
Binary file not shown.
Binary file added __pycache__/forms.cpython-36.pyc
Binary file not shown.
Binary file added __pycache__/wordchef.cpython-36.pyc
Binary file not shown.
Binary file added __pycache__/wsgi.cpython-36.pyc
Binary file not shown.
Binary file removed templates.zip
Binary file not shown.
21 changes: 21 additions & 0 deletions templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<html>
<head>
{% if title %}
<title>{{ title }}</title>
{% else %}
<title>Welcome</title>
{% endif %}
</head>
<body>
{% with messages = get_flashed_messages() %}
{% if messages %}
<ul>
{% for message in messages %}
<li>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
{% block content %}{% endblock %}
</body>
</html>
17 changes: 17 additions & 0 deletions templates/recipe.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends "base.html" %}

{% block content %}
<h1>word+chef</h1>
<form action="" method="post" novalidate>
{{ form.hidden_tag() }}
<p>
{{ form.word1.label }}<br>
{{ form.word1(size=32) }}
</p>
<p>
{{ form.word2.label }}<br>
{{ form.word2(size=32) }}
</p>
<p>{{ form.submit() }}</p>
</form>
{% endblock %}
5 changes: 4 additions & 1 deletion wordchef.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
from flask import Flask, render_template
from flask import Flask, render_template, flash, redirect
from forms import RecipeForm
app = Flask(__name__)
app.config['SECRET_KEY'] = 'play-it-as-it-lays'

@app.route("/wordchef/", methods=['GET','POST'])
def recipe():
form = RecipeForm()
if form.validate_on_submit():
flash('word1={}, word2={}'.format(form.word1.data, form.word2.data))
return redirect('/wordchef')
return render_template('recipe.html', title='word+chef', form=form)

if __name__ == "__main__":
Expand Down

0 comments on commit b7f5957

Please sign in to comment.