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


Python Post.update_attachments方法代码示例

本文整理汇总了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
开发者ID:daigong,项目名称:DForum,代码行数:35,代码来源:forms.py

示例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
开发者ID:alexliyu,项目名称:mobilesystem,代码行数:36,代码来源:forms.py

示例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
开发者ID:REDISS,项目名称:LBForum,代码行数:21,代码来源:forms.py

示例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
开发者ID:ajcronk,项目名称:SimpleLBForum,代码行数:24,代码来源:forms.py


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