Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/nutriweb/controllers/eating.py
blob: 09de29852221164576063b9857f4d09ab6ee2933 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# gettext import
from gettext import gettext as _

# server import
from server.flask import app, logger, render, request, jsonify


@app.route('/eating', methods=['GET', 'POST'])
def eating():
    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 = '_'
    # ..
    _content = {
                'title': _('Eating'),
                'other_dict': {
                               'word1': _word,
                               'word2': 'deux',
                               }
                }
    return render('nutriweb/eating.html', **_content)