当前位置: 首页>>代码示例>>Python>>正文


Python ExampleModel.put方法代码示例

本文整理汇总了Python中models.ExampleModel.put方法的典型用法代码示例。如果您正苦于以下问题:Python ExampleModel.put方法的具体用法?Python ExampleModel.put怎么用?Python ExampleModel.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.ExampleModel的用法示例。


在下文中一共展示了ExampleModel.put方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: new_example

# 需要导入模块: from models import ExampleModel [as 别名]
# 或者: from models.ExampleModel import put [as 别名]
def new_example():
    """Add a new example"""
    form = ExampleForm()
    if form.validate_on_submit():
        example = ExampleModel(
                    example_id = form.example_id.data,
                    example_title = form.example_title.data,
                    added_by = users.get_current_user()
                    )
        example.put()
        flash(u'Example successfully saved.', 'success')
        return redirect(url_for('list_examples'))
    return render_template('new_example.html', form=form)
开发者ID:limeyd,项目名称:flask-appengine-template,代码行数:15,代码来源:views.py

示例2: new_example

# 需要导入模块: from models import ExampleModel [as 别名]
# 或者: from models.ExampleModel import put [as 别名]
def new_example():
    """Add a new example, detecting whether or not App Engine is in read-only mode."""
    form = ExampleForm()
    if form.validate_on_submit():
        example = ExampleModel(
                    example_id = form.example_id.data,
                    example_title = form.example_title.data,
                    added_by = users.get_current_user()
                    )
        try:
            example.put()
            flash(u'Example successfully saved.', 'success')
            return redirect(url_for('list_examples'))
        except CapabilityDisabledError:
            flash(u'App Engine Datastore is currently in read-only mode.', 'failure')
            return redirect(url_for('list_examples'))
    return render_template('new_example.html', form=form)
开发者ID:cloudappsetup,项目名称:flask-appengine-template,代码行数:19,代码来源:views.py

示例3: dispatch_request

# 需要导入模块: from models import ExampleModel [as 别名]
# 或者: from models.ExampleModel import put [as 别名]
 def dispatch_request(self):
     examples = ExampleModel.query()
     form = ExampleForm()
     if form.validate_on_submit():
         example = ExampleModel(
             example_name=form.example_name.data,
             example_description=form.example_description.data,
             added_by=users.get_current_user()
         )
         try:
             example.put()
             example_id = example.key.id()
             flash(u'Example %s successfully saved.' % example_id, 'success')
             return redirect(url_for('list_examples'))
         except CapabilityDisabledError:
             flash(u'App Engine Datastore is currently in read-only mode.', 'info')
             return redirect(url_for('list_examples'))
     return render_template('list_examples.html', examples=examples, form=form)
开发者ID:Davidthecoolsmartguy,项目名称:flask-appengine-template,代码行数:20,代码来源:admin_list_examples.py

示例4: list_examples

# 需要导入模块: from models import ExampleModel [as 别名]
# 或者: from models.ExampleModel import put [as 别名]
def list_examples():
    """List all examples"""
    examples = ExampleModel.all()
    form = ExampleForm()
    if form.validate_on_submit():
        example = ExampleModel(
            example_name=form.example_name.data,
            example_description=form.example_description.data,
            added_by=users.get_current_user(),
        )
        try:
            example.put()
            example_id = example.key().id()
            flash(u"Example %s successfully saved." % example_id, "success")
            return redirect(url_for("list_examples"))
        except CapabilityDisabledError:
            flash(u"App Engine Datastore is currently in read-only mode.", "info")
            return redirect(url_for("list_examples"))
    return render_template("list_examples.html", examples=examples, form=form)
开发者ID:cenzino,项目名称:vp-gae,代码行数:21,代码来源:views.py

示例5: dispatch_request

# 需要导入模块: from models import ExampleModel [as 别名]
# 或者: from models.ExampleModel import put [as 别名]
    def dispatch_request(self):

        if request.method == "POST":
            form = request.get_json()
            example = ExampleModel(
                example_name = form['example_name'],
                example_description = form['example_description'],
                added_by = users.get_current_user()
            )

            try:
                example.put()
                example_id = example.key.id()
                return jsonify(result = {'status':'ok'})

            except CapabilityDisabledError:
                return jsonify(result = {'status':'DONT cant save'})

        else:
            return jsonify(result = {'status':'NOT is correct method'})
开发者ID:poxstone,项目名称:appg,代码行数:22,代码来源:admin_list_examples.py

示例6: dashboard

# 需要导入模块: from models import ExampleModel [as 别名]
# 或者: from models.ExampleModel import put [as 别名]
def dashboard():
    """List all examples"""
    email = request.args.get('email',"")
    profile = request.args.get('profile',"")
    logging.info("email=%s profile=%s",email,profile)
    examples = ExampleModel.query()
    form = ExampleForm()
    if form.validate_on_submit():
        example = ExampleModel(
            example_name=form.example_name.data,
            example_description=form.example_description.data,
            added_by=users.get_current_user()
        )
        try:
            example.put()
            example_id = example.key.id()
            flash(u'Example %s successfully saved.' % example_id, 'success')
            return redirect(url_for('dashboard'))
        except CapabilityDisabledError:
            flash(u'App Engine Datastore is currently in read-only mode.', 'info')
            return redirect(url_for('dashboard'))
    return render_template('dashboard.html', examples=examples, form=form)
开发者ID:carlosrojaso,项目名称:novabigdata,代码行数:24,代码来源:views.py


注:本文中的models.ExampleModel.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。