Exemple #1
0
 def save(self, *args, **kwargs):
     self.post_html = render_trevor(self.post_trevor)
     if self.more_trevor:
         self.more_html = render_trevor(self.more_trevor)
     else:
         self.more_html = ''
     super().save(*args, **kwargs)
Exemple #2
0
    def save(self, *args, **kwargs):
        self.lead_text_html = render_trevor(self.lead_text_trevor)
        self.main_text_html = render_trevor(self.main_text_trevor)
        if self.cover_credits_trevor:
            self.cover_credits_html = render_trevor(self.cover_credits_trevor)
        else:
            self.cover_credits_html = ''

        if self.reviewed:
            # Only post (or update) mentions once the article is public.
            songs_mentioned = find_songs_mentioned_in_article(self)

            existing_mentions = SongMention.objects.filter(article=self)
            for mention in existing_mentions:
                if mention.song not in songs_mentioned:
                    mention.delete()

            for song in songs_mentioned:
                if not SongMention.objects.filter(
                        article=self, song=song).first():
                    new_mention = SongMention()
                    new_mention.article = self
                    new_mention.song = song
                    new_mention.save()

        return super().save(*args, **kwargs)
Exemple #3
0
 def save(self, *args, **kwargs):
     self.lead_text_html = render_trevor(self.lead_text_trevor)
     self.main_text_html = render_trevor(self.main_text_trevor)
     if self.cover_credits_trevor:
         self.cover_credits_html = render_trevor(self.cover_credits_trevor)
     else:
         self.cover_credits_html = ""
     super().save(*args, **kwargs)
Exemple #4
0
 def save(self, *args, **kwargs):
     self.text_html = render_trevor(self.text_trevor)
     super().save(*args, **kwargs)
Exemple #5
0
 def save(self, *args, **kwargs):
     self.description_html = render_trevor(self.description_trevor)
     super().save(*args, **kwargs)