本文整理汇总了Python中models.Topic.updated_at方法的典型用法代码示例。如果您正苦于以下问题:Python Topic.updated_at方法的具体用法?Python Topic.updated_at怎么用?Python Topic.updated_at使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Topic
的用法示例。
在下文中一共展示了Topic.updated_at方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: saveTopic
# 需要导入模块: from models import Topic [as 别名]
# 或者: from models.Topic import updated_at [as 别名]
def saveTopic(self):
topic = Topic()
topic.class_type = self.class_type.data
topic.class_id = int(self.class_id.data)
topic.subject = self.subject.data
topic.content = self.content.data
topic.project_id = self.project.id
topic.user_id = self.user.id
current_time = int(time.time())
topic.created_at = current_time
topic.updated_at = current_time
db.session.add(topic)
db.session.commit()
project = topic.project
for atta_id in self.attachments:
atta = Attachment.query.get(atta_id)
atta.topic_id = topic.id
atta.project_id = topic.project_id
atta.root_class = topic.class_type
if topic.class_id == 0:
atta.root_id = topic.id
else:
atta.root_id = topic.class_id
db.session.commit()
project.file_count += 1
db.session.commit()
return topic