コード例 #1
0
ファイル: app.py プロジェクト: jstacoder/flask-talks
def add_talk(name, topics=None):
    talk = Talk(name=name)
    if topics is not None:
        for t in topics:
            if not type(t) == Topic:
                _topic = t['topic']
                _subs = t['sub_topics']
                add_topic(talk, _topic, _subs)
            else:
                add_topic(talk, t)
    return talk.save()
コード例 #2
0
ファイル: app.py プロジェクト: jstacoder/flask-talks
def add_talk(name,topics=None):
    talk = Talk(name=name)
    if topics is not None:
        for t in topics:
            if not type(t) == Topic:
                _topic = t['topic']
                _subs = t['sub_topics']
                add_topic(talk,_topic,_subs)
            else:
                add_topic(talk,t)
    return talk.save()
コード例 #3
0
ファイル: app.py プロジェクト: jstacoder/flask-talks
 def post(self):
     talk = Talk.objects(id=flask.request.form['talk_id'])
     talk = (len(talk) > 0) and talk[0]
     topic = Topic(name=flask.request.form['name']).save()
     talk.topics.append(topic)
     talk.save()
     return flask.jsonify(talk=json.loads(talk.to_json()))
コード例 #4
0
ファイル: app.py プロジェクト: jstacoder/flask-talks
 def post(self):
     talk = Talk.objects(id=flask.request.form['talk_id'])
     talk = (len(talk)>0) and talk[0]
     topic = Topic(name=flask.request.form['name']).save()
     talk.topics.append(topic)
     talk.save()
     return flask.jsonify(talk=json.loads(talk.to_json()))
コード例 #5
0
ファイル: app.py プロジェクト: jstacoder/flask-talks
 def get(self, talk_id):
     talk = Talk.objects(id=talk_id)
     talk = (len(talk) > 0) and talk[0]
     rtn = format_talk(talk.to_json())
     return flask.render_template('talks.html',
                                  talk=rtn,
                                  talk_id=talk_id,
                                  is_edit_mode=is_edit())
コード例 #6
0
ファイル: app.py プロジェクト: jstacoder/flask-talks
 def get(self,talk_id):
     talk = Talk.objects(id=talk_id)
     talk = (len(talk)>0) and talk[0]
     rtn = format_talk(talk.to_json())
     return flask.render_template('talks.html',talk=rtn,talk_id=talk_id,is_edit_mode=is_edit())