当前位置: 首页>>代码示例>>Python>>正文


Python Note.content方法代码示例

本文整理汇总了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}
开发者ID:honza,项目名称:stickies-app,代码行数:47,代码来源:views.py

示例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}
开发者ID:jie,项目名称:sportsapp,代码行数:20,代码来源:app.py

示例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
开发者ID:tominovak33,项目名称:notes-webapp,代码行数:22,代码来源:handlers.py

示例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)
开发者ID:Jablet,项目名称:odac-ford-housing,代码行数:23,代码来源:views.py


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