如何解决我是否应该可以使用“ runserver”在网站上提出问题?
我正在关注this Django教程。到目前为止,我还没有遇到任何问题,但是现在我不确定我是否正确理解了这个问题。我们创建了一个快捷方式功能来创建问题,但是我认为这是为了用户端,当我使用“ runserver”时,在网站上没有这样的选项,只有以前创建的问题。这是该函数的代码:
def create_question(question_text,days):
"""
Create a question with the given `question_text` and published the
given number of `days` offset to now (negative for questions published
in the past,positive for questions that have yet to be published).
"""
time = timezone.now() + datetime.timedelta(days=days)
return Question.objects.create(question_text=question_text,pub_date=time)
我弄错了吗?此功能仅在管理员方面有效吗?在“ polls / test.py”上,并且在每个课程之外。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。