コード例 #1
0
ファイル: models.py プロジェクト: Blackrose/niji
 def save(self, *args, **kwargs):
     new_hash = xxhash.xxh64(self.content_raw).hexdigest()
     mentioned_users = []
     if new_hash != self.raw_content_hash or (not self.pk):
         # To (re-)render the content if content changed or topic is newly created
         self.content_rendered, mentioned_users = render_content(self.content_raw, sender=self.user.username)
     super(Topic, self).save(*args, **kwargs)
     self.raw_content_hash = new_hash
     for to in mentioned_users:
             notify.delay(to=to.username, sender=self.user.username, topic=self.pk)
コード例 #2
0
 def save(self, *args, **kwargs):
     new_hash = xxhash.xxh64(self.content_raw).hexdigest()
     mentioned_users = []
     if new_hash != self.raw_content_hash or (not self.pk):
         # To (re-)render the content if content changed or topic is newly created
         self.content_rendered, mentioned_users = render_content(self.content_raw, sender=self.user.username)
     super(Topic, self).save(*args, **kwargs)
     self.raw_content_hash = new_hash
     for to in mentioned_users:
             notify.delay(to=to.username, sender=self.user.username, topic=self.pk)
コード例 #3
0
ファイル: models.py プロジェクト: Blackrose/niji
 def save(self, *args, **kwargs):
     new_hash = xxhash.xxh64(self.content_raw).hexdigest()
     mentioned_users = []
     if new_hash != self.raw_content_hash or (not self.pk):
         self.content_rendered, mentioned_users = render_content(self.content_raw, sender=self.user.username)
     super(Post, self).save(*args, **kwargs)
     t = self.topic
     t.reply_count = t.get_reply_count()
     t.last_replied = t.get_last_replied()
     t.save(update_fields=['last_replied', 'reply_count'])
     for to in mentioned_users:
             notify.delay(to=to.username, sender=self.user.username, post=self.pk)
コード例 #4
0
 def save(self, *args, **kwargs):
     new_hash = xxhash.xxh64(self.content_raw).hexdigest()
     mentioned_users = []
     if new_hash != self.raw_content_hash or (not self.pk):
         self.content_rendered, mentioned_users = render_content(self.content_raw, sender=self.user.username)
     super(Post, self).save(*args, **kwargs)
     t = self.topic
     t.reply_count = t.get_reply_count()
     t.last_replied = t.get_last_replied()
     t.save(update_fields=['last_replied', 'reply_count'])
     for to in mentioned_users:
         notify.delay(to=to.username, sender=self.user.username, post=self.pk)