diff options
Diffstat (limited to 'nutriweb/controllers/eating.py')
-rw-r--r-- | nutriweb/controllers/eating.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/nutriweb/controllers/eating.py b/nutriweb/controllers/eating.py new file mode 100644 index 0000000..47e45cd --- /dev/null +++ b/nutriweb/controllers/eating.py @@ -0,0 +1,46 @@ +# python import +import logging +# .. +from gettext import gettext as _ + +# make module +from flask import jsonify, Module, request +_module = Module(__name__) + +# bewype import +from bewype.flask import app + +# nutriweb import +from nutriweb.controllers.base import render as r + + +# get application logger +logger = logging.getLogger('nutriweb') + + +@_module.route('/eating', methods=['GET', 'POST']) +def index(): + if request.method == 'POST': + if 'difficutly' in request.form: + _word = request.form['difficutly'] + elif 'difficutly-ajax' in request.form: + _ajax_content = { + 'word': request.form['difficutly-ajax'] + } + return jsonify(_ajax_content) + else: + _word = '??' + else: + _word = 'null' + + _content = { + 'title': [_('Eating'), 'test'], + 'other_dict': { + 'word1': _word, + 'word2': 'deux', + } + } + return r('nutriweb/eating.html', **_content) + +# do register +app.register_module(_module)
\ No newline at end of file |