本文整理汇总了Python中models.Note.query方法的典型用法代码示例。如果您正苦于以下问题:Python Note.query方法的具体用法?Python Note.query怎么用?Python Note.query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Note
的用法示例。
在下文中一共展示了Note.query方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import query [as 别名]
def get(self):
if 'X-AppEngine-Cron' not in self.request.headers:
self.error(403)
notes = Note.query().fetch()
for note in notes:
self._shrink_note(note)
示例2: get_note_counter
# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import query [as 别名]
def get_note_counter():
data = memcache.get('note_count')
if data is None:
data = Note.query().count()
memcache.set('note_count', data)
return data
示例3: get
# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import query [as 别名]
def get(self):
# otherwise task queue request is not received
if 'X-Appengine-Cron' not in self.request.headers:
self.error(403) # Forbidden
# load all Note entities from datastore
notes = Note.query().fetch()
for note in notes:
self._shrink_note(note)
示例4: note_for_company
# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import query [as 别名]
def note_for_company(self, request):
user = endpoints.get_current_user()
query = Note.query(ancestor=main.get_parent_key(user)).filter(Note.company_entity_key == request.company_entity_key)
returnNote = Note(note="", company_entity_key=request.company_entity_key)
for note in query:
returnNote = note
break
return returnNote
示例5: get
# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import query [as 别名]
def get(self):
notes_query = Note.query(Note.user == self.user.key)
notes = notes_query.fetch()
template_values = {
'user': self.user,
'notes': notes,
'description': 'Notes App - Admin Area'
}
templates.render_page("notes/home", template_values, self)
# get the users notes here
return
示例6: list_notes
# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import query [as 别名]
def list_notes():
notes = Note.query()
# Convert body of each note to marked-up markdown
for note in notes:
note.body = Markup(markdown.markdown(note.body))
form = NoteForm()
if form.validate_on_submit():
note = Note(title=form.note_title.data,
slug=slugify(form.note_title.data),
body=form.note_body.data,
author=users.get_current_user())
try:
note.put()
note_id = note.key.id()
flash(u'Note %s saved.' % note_id, 'success')
return redirect(url_for('list_notes'))
except CapabilityDisabledError:
flash(u'Datastore is in read-only mode.', 'info')
return redirect(url_for('list_notes'))
return render_template('dynamic_notes.html', notes=notes, form=form)
示例7: cached_notes
# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import query [as 别名]
def cached_notes():
notes = Note.query()
return render_template('list_notes_cached', notes=notes)