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


Python Post.convert_string_tags方法代码示例

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


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

示例1: new_post

# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import convert_string_tags [as 别名]
def new_post():
    form = PostForm()
    if form.validate_on_submit():
        post = Post(title=form.title.data, category=form.category.data, tags=Post.convert_string_tags(form.tags.data))
        try:
            post.put()
            flash(u"Example %s successfully saved." % post.id, "success")
            return redirect(url_for("list_posts"))
        except CapabilityDisabledError:
            flash(u"App Engine Datastore is currently in read-only mode.", "info")
            return redirect(url_for("list_posts"))
    return render_template("new_post.html", form=form)
开发者ID:cenzino,项目名称:vp-gae,代码行数:14,代码来源:views.py

示例2: edit_post

# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import convert_string_tags [as 别名]
def edit_post(post_id):
    post = Post.get_by_id(post_id)
    form = PostForm(obj=post)

    if form.validate_on_submit():
        form.tags.data = Post.convert_string_tags(form.tags.data)
        form.populate_obj(post)
        try:
            post.put()
            flash(u"Example %s successfully saved." % post.id, "success")
            # return redirect(url_for('edit_post.html'))
        except CapabilityDisabledError:
            flash(u"App Engine Datastore is currently in read-only mode.", "info")
            return redirect(url_for("list_posts"))
    return render_template("edit_post.html", form=form, post_id=post_id)
开发者ID:cenzino,项目名称:vp-gae,代码行数:17,代码来源:views.py

示例3: edit_post

# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import convert_string_tags [as 别名]
def edit_post(id):
    post = Post.get_by_id(id)
    form = PostForm(request.form, post)

    if form.validate_on_submit():
        form.tags.data = Post.convert_string_tags(form.tags.data)
        form.populate_obj(post)
        try:
            post.save()
            flash(u'Post aggiornato.', 'success')
            return redirect(url_for('list_posts'))
        except CapabilityDisabledError:
            flash(u'App Engine Datastore is currently in read-only mode.', 'failure')
            return redirect(url_for('list_posts'))
    return render_template('edit_post.html', form=form)
开发者ID:cenzino,项目名称:vp-old-gae,代码行数:17,代码来源:views.py

示例4: new_post

# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import convert_string_tags [as 别名]
def new_post():
    form = PostForm()
    if form.validate_on_submit():
        post = Post(
            title = form.title.data,
            text = form.text.data,
            text_html = form.text.data,
            tags = Post.convert_string_tags(form.tags.data),
            #tags = []
        )
        
        #post = Post()
        #form.populate_obj(post)
        try:
            post.save()
            flash(u'Post salvato.', 'success')
            return redirect(url_for('list_posts'))
        except CapabilityDisabledError:
            flash(u'App Engine Datastore is currently in read-only mode.', 'failure')
            return redirect(url_for('list_posts'))
    return render_template('new_post.html', form=form)
开发者ID:cenzino,项目名称:vp-old-gae,代码行数:23,代码来源:views.py


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