예제 #1
0
 def save(self, *args, **kwargs):        
     add_status = not self.id
     super(Topic, self).save(*args, **kwargs) 
     if add_status:        
         s = Status()
         s.user = self.author
         s.app = self.community_widget.app
         s.source_type = SOURCE_TYPE_COMMUNITY
         s.source_id = self.community.id
         s.source_widget_id = self.community_widget.id
         
         s.object_id = self.id
         s.title = self.title
         s.save()
         self.status = s
         super(Topic, self).save(*args, **kwargs) 
예제 #2
0
    def save(self, *args, **kwargs):     
        add_status = not self.id   
        if self.link and not self.domain:
            self.domain = Domain.get_domain(get_domain(self.link))
            self.domain.count += 1
            self.domain.save()
        self.handle_link()
        super(Topic, self).save(*args, **kwargs)
        #also called in update? sometimes necessary.
        self.download_image()
        
        if add_status:        
            s = Status()
            s.user = self.author
            s.app = self.community_widget.app
            s.source_type = SOURCE_TYPE_COMMUNITY
            s.source_id = self.community.id
            s.source_widget_id = self.community_widget.id

            s.content_type = ContentType.objects.get_for_model(Topic)
            s.object_id = self.id
            s.title = self.title
            s.save()
            self.status = s
            super(Topic, self).save(*args, **kwargs)