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


Python Note.public方法代码示例

本文整理汇总了Python中models.Note.public方法的典型用法代码示例。如果您正苦于以下问题:Python Note.public方法的具体用法?Python Note.public怎么用?Python Note.public使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Note的用法示例。


在下文中一共展示了Note.public方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: homepage

# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import public [as 别名]
def homepage():
    if request.method == 'POST':
        if request.form.get('content'):
            note = Note.create(content=request.form['content'])

            rendered = render_template('note.html', note=note)
            return redirect(url_for('homepage'))
        return jsonify({'success': False})
    notes = Note.public().limit(50)
    return render_template('homepage.html', notes=notes)
开发者ID:bearzk,项目名称:try_peewee,代码行数:12,代码来源:views.py

示例2: homepage

# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import public [as 别名]
def homepage():
    if not session.get('logged_in'):
        return redirect(url_for('login'))
    if request.method == 'POST':
        if request.form.get('content'):
            note = Note.create(content=request.form['content'])
            flash('New entry posted')
            return redirect(url_for('homepage'))

    notes = Note.public().paginate(get_page(), 50)
    return render_template('homepage.html', notes=notes)
开发者ID:bayang,项目名称:calepin,代码行数:13,代码来源:views.py

示例3: homepage

# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import public [as 别名]
def homepage():
	if request.method == 'POST':
		if request.form.get('content'):
			# New note
			note = Note.create(content = request.form['content'])
			# Make a note panel and jsonify
			rendered = render_template('note.html', note = note)
			return jsonify({'note': rendered, 'success': True})

		# no content, return failure
		return jsonify({'success': False})

	notes = Note.public().limit(50)
	return render_template('homepage.html', notes = notes)
开发者ID:raincrash,项目名称:LinkBox,代码行数:16,代码来源:views.py

示例4: homepage

# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import public [as 别名]
def homepage():
    if request.method == 'POST':
        #create a new note in the db
        if request.form.get('content'):
            note = Note.create(content=request.form['content'])

            # Render a single note panel and return the HTML.
            rendered = render_template('note.html', note=note)
            return jsonify({'note': rendered, 'success': True})

        return jsonify({'success': False})

    notes = Note.public().paginate(get_page(), 50)
    return render_template('homepage.html', notes=notes)
开发者ID:ariakerstein,项目名称:NotesApp-flask,代码行数:16,代码来源:views.py

示例5: homepage

# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import public [as 别名]
def homepage():
    if request.method == 'POST':
        if request.form.get('content'):
            # Create a new note in the db.
            note = Note.create(content=request.form['content'])

            # Render a single note panel and return the HTML.
            rendered = render_template('note.html', note=note)
            return jsonify({'note': rendered, 'success': True})

        # If there's no content, indicate a failure.
        return jsonify({'success': False})

    notes = Note.public().limit(50)
    return render_template('homepage.html', notes=notes)
开发者ID:essce,项目名称:wiki-stan,代码行数:17,代码来源:views.py

示例6: homepage

# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import public [as 别名]
def homepage():
    if request.method == 'POST':
        print('/ request method is post')
        if request.form.get('content'):
            print('/ request metho is post,content is ', request.form['content'])

            note = Note.create(content=request.form['content'])

            rendered = render_template('note.html', note=note)
            return jsonify({'note': rendered, 'success': True})

        return jsonify({'success': False})
    print('/ request method is get')
    notes = Note.public().paginate(get_page(), 50)
    return render_template('homepage.html', notes=notes)
开发者ID:qomosoloto,项目名称:flask-blog,代码行数:17,代码来源:views.py

示例7: homepage

# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import public [as 别名]
def homepage():
    """
    Displays the list of notes and creates new ones
    """
    if request.method == 'POST':
        if request.form.get('content'):
            # Create a new note in the db.
            note = Note.create(title=request.form['title'],
                               content=request.form['content'],
                               categories=request.form['categories'])

            # Render a single note panel and return the HTML.
            rendered = render_template('note.html', note=note)
            return jsonify({'note': rendered, 'success': True})

        # If there's no content, indicate a failure.
        return jsonify({'success': False})

    # For now it will only show the 50 most recent notes,
    # for us not to worry with pagination.
    notes = Note.public().limit(50)
    return render_template('homepage.html', notes=notes)
开发者ID:antrianis,项目名称:noteit,代码行数:24,代码来源:views.py

示例8: get_query

# 需要导入模块: from models import Note [as 别名]
# 或者: from models.Note import public [as 别名]
 def get_query(self):
     return Note.public()
开发者ID:tolmun,项目名称:flask-notes,代码行数:4,代码来源:api.py


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