本文整理汇总了Python中models.Article.body方法的典型用法代码示例。如果您正苦于以下问题:Python Article.body方法的具体用法?Python Article.body怎么用?Python Article.body使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Article
的用法示例。
在下文中一共展示了Article.body方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_article
# 需要导入模块: from models import Article [as 别名]
# 或者: from models.Article import body [as 别名]
def add_article():
if request.method == 'POST':
art = Article()
art.author_id = current_user.id
art.body = request.form.get("body")
art.css = request.form.get("css")
art.javascript_before = request.form.get("javascript_before")
art.javascript_after = request.form.get("javascript_after")
art.title = request.form.get("title")
art.author_blurb = request.form.get("author_blurb")
base_app.db.session.add(art)
base_app.db.session.commit()
return default()
return render_template("add_article.html")
示例2: __save_blog
# 需要导入模块: from models import Article [as 别名]
# 或者: from models.Article import body [as 别名]
def __save_blog(title, abstract, body, category_id, tag_names, article_id=None):
tags = []
for tag_name in tag_names.split(','):
tag, is_create = Tag.objects.get_or_create(name=tag_name)
tags.append(tag)
category = Category.objects.filter(id=category_id)[0]
if article_id is None:
article = Article(title=title, abstract=abstract, body=body, category=category)
else:
article = Article.objects.filter(id=article_id)[0]
article.title = title
article.abstract = abstract
article.body = body
article.category = category
article.save()
print dir(article)
article.tag.clear()
article.tag.add(*tags)
return article.id