本文整理汇总了Python中models.Question.views方法的典型用法代码示例。如果您正苦于以下问题:Python Question.views方法的具体用法?Python Question.views怎么用?Python Question.views使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Question
的用法示例。
在下文中一共展示了Question.views方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: asking
# 需要导入模块: from models import Question [as 别名]
# 或者: from models.Question import views [as 别名]
def asking(request, **kwargs):
try:
q_body = request.form['question-body']
q_title = request.form['question-title']
q_cat = request.form['question-category']
except KeyError:
return questions(request)
q = Question()
q.views = 0
q.votes = 0
q.body = q_body
q.title = q_title
q.category_id = Category.get(where=('category_name',q_cat))[0].id
q.user_id = local.request.session['uid']
q.insert()
return question(request, qid = q.id)