本文整理汇总了Python中poll.models.Poll.expires_on方法的典型用法代码示例。如果您正苦于以下问题:Python Poll.expires_on方法的具体用法?Python Poll.expires_on怎么用?Python Poll.expires_on使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类poll.models.Poll
的用法示例。
在下文中一共展示了Poll.expires_on方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: convert_polls
# 需要导入模块: from poll.models import Poll [as 别名]
# 或者: from poll.models.Poll import expires_on [as 别名]
def convert_polls(self):
self.clear_polls()
cursor = connection.cursor()
cursor.execute("SELECT * FROM smf_polls")
rows = cursor.fetchall()
for row in rows:
try:
profile = Profile.objects.get(old_user_id=row[7])
try:
poll = Poll()
poll.old_poll_id = row[0]
poll.user = profile.user
poll.username = row[8]
poll.question = row[1]
if row[2] == 1:
poll.locked = True
poll.expires_on = self.fix_epoch(row[4])
if row[5] == 0:
poll.hide_results_until_vote = False
if row[6] == 0:
poll.allow_changing_votes = False
poll.allow_changing_votes = False
if row[9] == 1:
poll.allow_changing_votes = True
poll.hide_results_until_expored = False
poll.save()
except Exception, e:
print "Could not save poll: %s" % (str(e))
except Profile.DoesNotExist, e:
pass