本文整理汇总了Python中models.Note.all方法的典型用法代码示例。如果您正苦于以下问题:Python Note.all方法的具体用法?Python Note.all怎么用?Python Note.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Note
的用法示例。
在下文中一共展示了Note.all方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testNote
# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import all [as 别名]
def testNote(self):
Note(author=self.current_user, title='Test 1', public=False).put()
self.assertEqual(1, Note.all().count(10))
Note(author=self.current_user, title='Test 2', public=True).put()
self.assertEqual(2, Note.all().count(10))
Note(author=self.current_user, title='Test 3', text=u'Treść', url='jkpluta.appspot.com', public=True).put()
self.assertEqual(3, Note.all().count(10))
with self.assertRaises(datastore_errors.BadValueError):
Note().put()
with self.assertRaises(datastore_errors.BadValueError):
Note().put(author=self.current_user, title='Test X')
with self.assertRaises(datastore_errors.BadValueError):
Note().put(author=self.current_user, public=False)
self.assertEqual(3, Note.all().count(10))
示例2: add_note
# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import all [as 别名]
def add_note():
"""Add a note."""
form = ArticleForm()
if request.method == 'POST':
if form.validate_on_submit():
# Get the right number - the article ID
number = 1
notes = Note.all().order('-number')
if notes.count() > 0:
number = notes[0].number + 1
note = Note(
number=number,
title=form.title.data,
content=form.content.data,
tags=form.tags.data,
)
note.save()
return redirect(note.get_absolute_url())
action_url = url_for('add_note')
return render_template('add_note.html', form=form, action_url=action_url)
示例3: ntfeed
# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import all [as 别名]
def ntfeed():
notes = Note.all().order('-added')
return render_template('ntfeed.atom', notes=notes)
示例4: note
# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import all [as 别名]
def note():
notes = Note.all().order('-added')
return render_template('note.html', notes=notes)
示例5: ntedit_list
# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import all [as 别名]
def ntedit_list():
"""Render website's index page."""
notes = Note.all().order('-added')
return render_template('ntedit_list.html', notes=notes)
示例6: get_note_by_number
# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import all [as 别名]
def get_note_by_number(number):
notes = Note.all()
notes = notes.filter('number ==', int(number))
if notes.count() == 0:
return None
return notes[0]
示例7: get
# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import all [as 别名]
def get(self):
allNotes = Note.all().order("-text")
template_values = {
'notes': allNotes
}
self.response.write(renderTemplate('index.html',template_values))