Exemplo n.º 1
0
 def save(self, *args, **kwargs):
     from DjangoBlog.blog_signals import article_save_signal
     if not self.slug or self.slug == 'no-slug' or not self.id:
         slug = self.title if 'title' in self.__dict__ else self.name
         self.slug = slugify(slug)
     super().save(*args, **kwargs)
     # type = self.__class__.__name__
     is_update_views = 'update_fields' in kwargs and len(kwargs['update_fields']) == 1 and kwargs['update_fields'][
         0] == 'views'
     article_save_signal.send(sender=self.__class__, is_update_views=is_update_views, id=self.id)
Exemplo n.º 2
0
 def save(self, *args, **kwargs):
     from DjangoBlog.blog_signals import article_save_signal
     if not self.slug or self.slug == 'no-slug' or not self.id:
         slug = self.title if 'title' in self.__dict__ else self.name
         self.slug = slugify(slug)
     super().save(*args, **kwargs)
     # type = self.__class__.__name__
     is_update_views = 'update_fields' in kwargs and len(kwargs['update_fields']) == 1 and kwargs['update_fields'][
         0] == 'views'
     article_save_signal.send(sender=self.__class__, is_update_views=is_update_views, id=self.id)