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


Python Question.author_id方法代码示例

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


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

示例1: save

# 需要导入模块: from models import Question [as 别名]
# 或者: from models.Question import author_id [as 别名]
 def save(self):
     question = Question(**self.cleaned_data)
     if question.author_id:
         question.author_id += 1
     else:
         question.author_id = 1
     question.save()
     return question
开发者ID:padznich,项目名称:web,代码行数:10,代码来源:forms.py

示例2: filldb

# 需要导入模块: from models import Question [as 别名]
# 或者: from models.Question import author_id [as 别名]
def filldb(request, cou):
    for x in range(0, int(cou)):
        q = Question(title = "Question #"+str(x),
                     text = "Just a question with number "+str(x))
        q.rating = x
        q.author_id = 1
        q.added_at = date(2016, 03, 1+x)
        q.save()
        q.added_at = date(2016, 03, 1+x)
        for y in range(1, x+2):
            a = Answer(text = "answer #"+str(y)+" for question #"+str(x))
            a.author_id = 1
            q.answer_set.add(a)
        q.save()
    return HttpResponse("OK")
开发者ID:Bushische,项目名称:stepic16,代码行数:17,代码来源:views.py

示例3: save

# 需要导入模块: from models import Question [as 别名]
# 或者: from models.Question import author_id [as 别名]
 def save(self):
     print 'AskF save: (%s)' % (self.cleaned_data)
     quest = Question(**self.cleaned_data)
     quest.author_id = 1
     quest.save()
     return quest
开发者ID:Bushische,项目名称:stepic16,代码行数:8,代码来源:forms.py

示例4: save

# 需要导入模块: from models import Question [as 别名]
# 或者: from models.Question import author_id [as 别名]
 def save(self):
     question = Question(**self.cleaned_data)
     question.author_id = self._user.id
     question.save()
     return question
开发者ID:mISCLETI,项目名称:stepic_web_project,代码行数:7,代码来源:forms.py


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