本文整理汇总了Python中models.ExampleModel.query方法的典型用法代码示例。如果您正苦于以下问题:Python ExampleModel.query方法的具体用法?Python ExampleModel.query怎么用?Python ExampleModel.query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.ExampleModel
的用法示例。
在下文中一共展示了ExampleModel.query方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: quick_list
# 需要导入模块: from models import ExampleModel [as 别名]
# 或者: from models.ExampleModel import query [as 别名]
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)
示例2: dispatch_request
# 需要导入模块: from models import ExampleModel [as 别名]
# 或者: from models.ExampleModel import query [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)
示例3: list_examples
# 需要导入模块: from models import ExampleModel [as 别名]
# 或者: from models.ExampleModel import query [as 别名]
def list_examples():
"""List all examples"""
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)
示例4: dashboard
# 需要导入模块: from models import ExampleModel [as 别名]
# 或者: from models.ExampleModel import query [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)
示例5: cached_examples
# 需要导入模块: from models import ExampleModel [as 别名]
# 或者: from models.ExampleModel import query [as 别名]
def cached_examples():
"""This view should be cached for 60 sec"""
examples = ExampleModel.query()
return render_template('list_examples_cached.html', examples=examples)
示例6: dispatch_request
# 需要导入模块: from models import ExampleModel [as 别名]
# 或者: from models.ExampleModel import query [as 别名]
def dispatch_request(self):
examples = ExampleModel.query()
return render_template('list_examples_cached.html', examples=examples)
示例7: dispatch_request
# 需要导入模块: from models import ExampleModel [as 别名]
# 或者: from models.ExampleModel import query [as 别名]
def dispatch_request(self):
list = ExampleModel.query().fetch()
list = to_dict(list)
return jsonify(results = list)
示例8: cached_dimensions
# 需要导入模块: from models import ExampleModel [as 别名]
# 或者: from models.ExampleModel import query [as 别名]
def cached_dimensions():
"""This view should be cached for 60 sec"""
dimensions = ExampleModel.query()
return render_template('list_dimensions_cached.html', dimensions=dimensions)