本文整理汇总了Python中models.Note.content方法的典型用法代码示例。如果您正苦于以下问题:Python Note.content方法的具体用法?Python Note.content怎么用?Python Note.content使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Note
的用法示例。
在下文中一共展示了Note.content方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _ajax
# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import content [as 别名]
def _ajax(request):
"""Wrapper"""
if not request.is_ajax():
return {'status': 403}
a = request.POST.get('a')
if a not in ['move', 'edit', 'delete', 'new']:
return {'status': 403}
if a in ['move', 'edit', 'delete']:
n = request.POST.get('note')
id = int(n[5:])
note = get_object_or_404(Note, pk=id)
try:
note = Note.objects.get(pk=id)
except ObjectDoesNotExist:
return {'status': 403}
if a in ['edit', 'new']:
content = request.POST.get('content')
if a == 'move':
st = request.POST.get('section')
if st not in STATES:
return {'status': 403}
note.state = st
elif a == 'delete':
note.delete()
return {'status': 200}
elif a == 'new':
p = request.POST.get('project')
p = get_object_or_404(Project, id=p)
note = Note(
content=content,
author=request.user,
project=p)
note.save()
return {
'status': 200,
'content': _note(note)
}
else:
note.content = content
note.save()
return {'status': 200}
示例2: create_note_api
# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import content [as 别名]
def create_note_api():
kind_id = flask.request.form.get('kind_id')
quantity = flask.request.form.get('quantity')
content = flask.request.form.get('content')
user_id = int(flask.session['user_id'])
# Check kind owner
note_kind = NoteKind.fetchone(pk=kind_id, user_id=user_id)
if not note_kind:
raise error.KindNotExistError()
note = Note()
note.kind_id = kind_id
note.user_id = user_id
note.content = content
note.quantity = quantity
note.save()
return {'pk': note.pk}
示例3: post
# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import content [as 别名]
def post(self):
user = self.user
if user:
content = self.request.get('note')
note = Note()
note.content = content
note.user = user.key
note.put()
# show confirma tion of successful post creation
template_values = {
'message': 'Note created successfully'
}
templates.render_page("notes/created", template_values, self)
else:
# error about login
return
return
示例4: note
# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import content [as 别名]
def note():
"""
Save a note related to a query.
"""
logger.debug("NOTE endpoint called")
user = current_user
content = request.form['content']
query_id = request.form['query_id']
# save note
tmp = Note()
tmp.user = user
tmp.content = content
tmp.query_id = query_id
db.session.add(tmp)
db.session.commit()
return redirect('/admin/queryview/', code=302)