Exemplo n.º 1
0
    def add_follower(self, follower, followee):
        """ Create 'follower' follows 'followee' relationship """
        relation = Follow.objects.create(follower=follower, followee=followee)

        follower_created.send(sender=self, follower=follower)
        following_created.send(sender=self, follow=followee)

        bust_cache('followers', followee.pk)
        bust_cache('following', follower.pk)

        return relation
Exemplo n.º 2
0
    def add_follower(self, follower, followee):
        """ Create 'follower' follows 'followee' relationship """
        relation = Follow.objects.create(follower=follower, followee=followee)

        follower_created.send(sender=self, follower=follower)
        following_created.send(sender=self, follow=followee)

        bust_cache('followers', followee.pk)
        bust_cache('following', follower.pk)

        return relation
Exemplo n.º 3
0
 def add_follower(self, follower, followee):
     """ Create 'follower' follows 'followee' relationship """
     if follower == followee:
         raise ValidationError("Users cannot follow themselves")
         
     relation,created = Follow.objects.get_or_create(follower=follower, followee=followee)
     if created:
         follower_created.send(sender=self, follower=follower,followee=followee)
         following_created.send(sender=self, follower=follower,followee=followee)
         bust_cache('followers', followee.pk)
         bust_cache('following', follower.pk)
     
     return relation
Exemplo n.º 4
0
    def add_follower(self, follower, followee):
        """ Create 'follower' follows 'followee' relationship """
        if follower == followee:
            raise ValidationError("Users cannot follow themselves")

        relation, created = Follow.objects.get_or_create(follower=follower, followee=followee)

        if created is False:
            raise AlreadyExistsError("User '%s' already follows '%s'" % (follower, followee))

        follower_created.send(sender=self, follower=follower)
        following_created.send(sender=self, follow=followee)

        bust_cache('followers', followee.pk)
        bust_cache('following', follower.pk)

        return relation
Exemplo n.º 5
0
    def add_follower(self, follower, followee):
        """ Create 'follower' follows 'followee' relationship """
        if follower == followee:
            raise ValidationError("Users cannot follow themselves")

        relation, created = Follow.objects.get_or_create(follower=follower, followee=followee)

        if created is False:
            raise AlreadyExistsError("User '%s' already follows '%s'" % (follower, followee))

        follower_created.send(sender=self, follower=follower)
        following_created.send(sender=self, follow=followee)

        bust_cache("followers", followee.pk)
        bust_cache("following", follower.pk)

        return relation