Ejemplo n.º 1
0
 def save(self, *args, **kwargs):
     add_status = not self.id
     super(Topic, self).save(*args, **kwargs)
     self.add_tags_to_db()
     
     if add_status:        
         s = Status()
         s.user = self.author
         if self.user_widget:
             s.app = self.user_widget.app
             s.source_type = SOURCE_TYPE_USER
             s.source_id = self.author.id
             s.source_widget_id = self.user_widget.id
         else:
             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)
Ejemplo n.º 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)