本文整理汇总了Python中models.Post.update_attachments方法的典型用法代码示例。如果您正苦于以下问题:Python Post.update_attachments方法的具体用法?Python Post.update_attachments怎么用?Python Post.update_attachments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Post
的用法示例。
在下文中一共展示了Post.update_attachments方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save
# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import update_attachments [as 别名]
def save(self):
topic_post = False
if not self.topic:
topic_type = self.cleaned_data['topic_type']
if topic_type:
topic_type = TopicType.objects.get(id=topic_type)
else:
topic_type = None
self.qvod_address = self.cleaned_data['qvod_address']
topic = Topic(forum=self.forum,
posted_by=self.user,
subject=self.cleaned_data['subject'],
need_replay=self.cleaned_data['need_replay'],
need_reply_attachments=self.cleaned_data['need_reply_attachments'],
topic_type=topic_type,
qvod_address=self.qvod_address,
has_qvod = has_qvod
)
topic_post = True
topic.save()
else:
topic = self.topic
post = Post(topic=topic, posted_by=self.user, poster_ip=self.ip,
message=self.cleaned_data['message'], topic_post=topic_post)
post.save()
if topic_post:
topic.post = post
topic.save()
attachments = self.cleaned_data['attachments']
post.update_attachments(attachments)
return post
示例2: save
# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import update_attachments [as 别名]
def save(self):
topic_post = False
if not self.topic:
topic_type = self.cleaned_data["topic_type"]
if topic_type:
topic_type = TopicType.objects.get(id=topic_type)
else:
topic_type = None
topic = Topic(
forum=self.forum,
posted_by=self.user,
subject=self.cleaned_data["subject"],
need_replay=self.cleaned_data["need_replay"],
need_reply_attachments=self.cleaned_data["need_reply_attachments"],
topic_type=topic_type,
)
topic_post = True
topic.save()
else:
topic = self.topic
post = Post(
topic=topic,
posted_by=self.user,
poster_ip=self.ip,
message=self.cleaned_data["message"],
topic_post=topic_post,
)
post.save()
if topic_post:
topic.post = post
topic.save()
attachments = self.cleaned_data["attachments"]
post.update_attachments(attachments)
return post
示例3: save
# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import update_attachments [as 别名]
def save(self):
topic_post = False
if not self.topic:
topic = Topic(forum=self.forum, posted_by=self.user, subject=self.cleaned_data["subject"])
topic_post = True
topic.save()
else:
topic = self.topic
post = Post(
topic=topic,
posted_by=self.user,
poster_ip=self.ip,
message=self.cleaned_data["message"],
topic_post=topic_post,
)
post.save()
attachments = self.cleaned_data["attachments"]
post.update_attachments(attachments)
return post
示例4: save
# 需要导入模块: from models import Post [as 别名]
# 或者: from models.Post import update_attachments [as 别名]
def save(self):
topic_post = False
if not self.topic:
topic = Topic(posted_by=self.user,
subject=self.cleaned_data['subject'],
category=self.cleaned_data['category'],
need_replay=self.cleaned_data['need_replay'],
need_reply_attachments=self.cleaned_data['need_reply_attachments'],
)
topic_post = True
topic.save()
else:
topic = self.topic
post = Post(topic=topic, posted_by=self.user, poster_ip=self.ip,
message=self.cleaned_data['message'], topic_post=topic_post)
post.save()
if topic_post:
topic.post = post
topic.save()
attachments = self.cleaned_data['attachments']
post.update_attachments(attachments)
return post