diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-03-21 16:59:18 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-03-21 16:59:18 -0700 |
commit | 5527ecc2b7bd81bab9bcb065adbbccd941b85be8 (patch) | |
tree | e8b01a20ee147858408c4058c707638a35649c1c /python/fatcat_web/routes.py | |
parent | 1f165c34a6179f96b6de0c616f21a319e3c4ccce (diff) | |
download | fatcat-5527ecc2b7bd81bab9bcb065adbbccd941b85be8.tar.gz fatcat-5527ecc2b7bd81bab9bcb065adbbccd941b85be8.zip |
major progress on release create form
Diffstat (limited to 'python/fatcat_web/routes.py')
-rw-r--r-- | python/fatcat_web/routes.py | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py index e2c5fc3a..81c4c5c1 100644 --- a/python/fatcat_web/routes.py +++ b/python/fatcat_web/routes.py @@ -11,6 +11,7 @@ from fatcat_web import app, api, auth_api, priv_api from fatcat_web.auth import handle_token_login, handle_logout, load_user, handle_ia_xauth from fatcat_web.cors import crossdomain from fatcat_web.search import * +from fatcat_web.forms import * ### Views ################################################################### @@ -311,22 +312,23 @@ def release_lookup(): abort(ae.status) return redirect('/release/{}'.format(resp.ident)) -@app.route('/release/create', methods=['GET']) -@login_required -def release_create_view(): - return render_template('release_create.html') - -@app.route('/release/create', methods=['POST']) +@app.route('/release/create', methods=['GET', 'POST']) @login_required def release_create(): - raise NotImplementedError - params = dict() - for k in request.form: - if k.startswith('release_'): - params[k[10:]] = request.form[k] - release = None - #edit = api.create_release(release, params=params) - #return redirect("/release/{}".format(edit.ident)) + form = ReleaseEntityForm() + if form.is_submitted(): + print("got form!") + print(form.errors) + if form.validate_on_submit(): + return redirect('/') + else: + print("didn't validate...") + if len(form.contribs) == 0: + form.contribs.append_entry() + form.contribs.append_entry() + form.contribs.append_entry() + form.contribs.append_entry() + return render_template('release_create.html', form=form) @app.route('/release/<ident>/history', methods=['GET']) def release_history(ident): |