• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python models.ExampleModel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: new_example

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,代码行数:13,代码来源:views.py


示例2: upload_pic

def upload_pic(request):
  
  c = {}
  c.update(csrf(request))  
  script_args['c'] = c
  
  if request.method == 'POST':
    form = ImageUploadForm(request.POST, request.FILES)
    if form.is_valid():
      m = ExampleModel()
      m.model_pic = form.cleaned_data['image']
      m.save()
      return HttpResponse('image upload success')
    
  return render_to_response("emc/upload_pic.html", c)    
开发者ID:zinglax,项目名称:EMCapplication,代码行数:15,代码来源:views.py


示例3: dispatch_request

    def dispatch_request(self):
        if request.method == "POST":

            form = request.get_json()
            example_id = form['example_id']

            if example_id:
                example = ExampleModel.get_by_id( int(example_id) )

                if example:
                    try:
                        example.example_name = form['example_name']
                        example.example_description = form['example_description']

                        example.put()
                        return jsonify(result = {'status':'ok'})

                    except CapabilityDisabledError:
                        return jsonify(result = {'status':'Error to update'})

                else:
                    return jsonify(result = {'status':'NOT item found'})

            else:
                return jsonify(result = {'status':'no example_example send'})

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


示例4: new_example

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,代码行数:17,代码来源:views.py


示例5: quick_list

def quick_list():
    """Test function for my simple form"""
    form = QuickListForm()
    examples = ExampleModel.query()
    form.cmb_map.choices = []
    for example in examples:
        form.cmb_map.choices.append((example.example_description, example.example_name))

    return render_template('quick_list.html', form=form)
开发者ID:qehgt,项目名称:flask-appengine-template,代码行数:9,代码来源:views.py


示例6: dispatch_request

 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,代码行数:18,代码来源:admin_list_examples.py


示例7: dispatch_request

 def dispatch_request(self, example_id):
     example = ExampleModel.get_by_id(example_id)
     if request.method == "POST":
         try:
             example.key.delete()
             flash(u"Example %s successfully deleted." % 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"))
开发者ID:pavelkraleu,项目名称:flask-appengine-template,代码行数:10,代码来源:admin_delete_example.py


示例8: delete_example

def delete_example(example_id):
    """Delete an example object"""
    example = ExampleModel.get_by_id(example_id)
    try:
        example.key.delete()
        flash(u'Example %s successfully deleted.' % 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'))
开发者ID:qehgt,项目名称:flask-appengine-template,代码行数:10,代码来源:views.py


示例9: delete_dimension

def delete_dimension(dimension_id):
    """Delete an dimension object"""
    dimension = ExampleModel.get_by_id(dimension_id)
    try:
        dimension.key.delete()
        flash(u'Example %s successfully deleted.' % dimension_id, 'success')
        return redirect(url_for('list_dimensions'))
    except CapabilityDisabledError:
        flash(u'App Engine Datastore is currently in read-only mode.', 'info')
        return redirect(url_for('list_dimensions'))
开发者ID:loughnane,项目名称:ta,代码行数:10,代码来源:views.py


示例10: delete_example

def delete_example(example_id):
    """Delete an example object"""
    example = ExampleModel.get_by_id(example_id)
    try:
        example.delete()
        flash(u"Example %s successfully deleted." % 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"))
开发者ID:cenzino,项目名称:vp-gae,代码行数:10,代码来源:views.py


示例11: list_examples

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,代码行数:19,代码来源:views.py


示例12: edit_example

def edit_example(example_id):
    example = ExampleModel.get_by_id(example_id)
    form = ExampleForm(obj=example)
    if request.method == "POST":
        if form.validate_on_submit():
            example.example_name = form.data.get('example_name')
            example.example_description = form.data.get('example_description')
            example.put()
            flash(u'Example %s successfully saved.' % example_id, 'success')
            return redirect(url_for('list_examples'))
    return render_template('edit_example.html', example=example, form=form)
开发者ID:qehgt,项目名称:flask-appengine-template,代码行数:11,代码来源:views.py


示例13: dispatch_request

 def dispatch_request(self, example_id):
     example = ExampleModel.get_by_id(example_id)
     if request.method == "POST":
         try:
             example.key.delete()
             cache.clear()
             flash(u'Example %s successfully deleted.' % 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'))
开发者ID:kamalgill,项目名称:flask-appengine-template,代码行数:11,代码来源:admin_delete_example.py


示例14: dashboard

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,代码行数:22,代码来源:views.py


示例15: list_examples

def list_examples():
    """List all examples"""
    examples = ExampleModel.all()
    return render_template('list_examples.html', examples=examples)
开发者ID:cloudappsetup,项目名称:flask-appengine-template,代码行数:4,代码来源:views.py


示例16: get_random_entry

def get_random_entry():
	entry = ExampleModel()
	entry.name = get_random_sentence().capitalize()
	entry.number = randint(1, 10)
	entry.description = get_random_sentence(10)
	return entry
开发者ID:anchex,项目名称:django-kendoui-backend,代码行数:6,代码来源:utils.py


示例17: cached_examples

def cached_examples():
    """This view should be cached for 60 sec"""
    examples = ExampleModel.query()
    return render_template('list_examples_cached.html', examples=examples)
开发者ID:qehgt,项目名称:flask-appengine-template,代码行数:4,代码来源:views.py


示例18: cached_dimensions

def cached_dimensions():
    """This view should be cached for 60 sec"""
    dimensions = ExampleModel.query()
    return render_template('list_dimensions_cached.html', dimensions=dimensions)
开发者ID:loughnane,项目名称:ta,代码行数:4,代码来源:views.py


示例19: dispatch_request

    def dispatch_request(self):

        examples = ExampleModel.query()
        return render_template('list_examples_cached.html', examples=examples)
开发者ID:Davidthecoolsmartguy,项目名称:flask-appengine-template,代码行数:4,代码来源:admin_list_examples_cached.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python models.Exercise类代码示例发布时间:2022-05-27
下一篇:
Python models.Event类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap