Exemplo n.º 1
0
class TopicFollowed(models.Model):
    """
    This model tracks which user follows which topic.
    It serves only to manual topic following.
    This model also indicates if the topic is followed by email.
    """

    class Meta:
        verbose_name = "Sujet suivi"
        verbose_name_plural = "Sujets suivis"

    topic = models.ForeignKey(Topic, db_index=True, on_delete=models.CASCADE)
    user = models.ForeignKey(User, related_name="topics_followed", db_index=True, on_delete=models.CASCADE)
    email = models.BooleanField("Notification par courriel", default=False, db_index=True)
    objects = TopicFollowedManager()

    def __str__(self):
        return f'<Sujet "{self.topic.title}" suivi par {self.user.username}>'
Exemplo n.º 2
0
class TopicFollowed(models.Model):
    """
    This model tracks which user follows which topic.
    It serves only to manual topic following.
    This model also indicates if the topic is followed by email.
    """

    class Meta:
        verbose_name = 'Sujet suivi'
        verbose_name_plural = 'Sujets suivis'

    topic = models.ForeignKey(Topic, db_index=True)
    user = models.ForeignKey(User, related_name='topics_followed', db_index=True)
    email = models.BooleanField('Notification par courriel', default=False, db_index=True)
    objects = TopicFollowedManager()

    def __str__(self):
        return '<Sujet "{0}" suivi par {1}>'.format(self.topic.title,
                                                    self.user.username)