-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added view that saves a dojo on datastore
- Loading branch information
Showing
2 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,19 @@ | ||
from dojomap import app | ||
from dojomap.forms import DojoForm | ||
from dojomap.models import Dojo | ||
from flask import render_template | ||
|
||
@app.route('/dojo/new') | ||
def new_dojo(): | ||
return render_template("new_dojo.html") | ||
|
||
@app.route('/dojo/new', methods=['POST']) | ||
def create_dojo(): | ||
form = DojoForm() | ||
|
||
if form.validate_on_submit(): | ||
dojo = Dojo(name=form.name.data, description=form.description.data, address=form.address.data) | ||
dojo.put() | ||
return "Saved" | ||
|
||
return render_template("new_dojo.html", form=form) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters