Beispiel #1
0
 def unfollow_user(self, user):
     self.following.remove(user)
     # invalidate caches
     following_cache = UserFollowingCache(prekey=self.user.id)
     following_cache.invalidate_cache()
     followers_cache = UserFollowersCache(prekey=user.id)
     followers_cache.invalidate_cache()
Beispiel #2
0
 def unfollow_user(self, user):
     self.following.remove(user)
     # invalidate caches
     following_cache = UserFollowingCache(prekey=self.user.id)
     following_cache.invalidate_cache()
     followers_cache = UserFollowersCache(prekey=user.id)
     followers_cache.invalidate_cache()
Beispiel #3
0
 def get_followers(self):
     """Gets User followers
     Returns a list of User objects
     """
     prekey = [self.user.id,]
     c = UserFollowersCache(prekey=self.user.id)
     followers = c.get()
     if followers is None:
         follower_profiles = self.user.followers.all()
         followers = [profile.user for profile in follower_profiles]
         c.cache_store(followers)
     return followers
Beispiel #4
0
 def get_followers(self):
     """Gets User followers
     Returns a list of User objects
     """
     prekey = [self.user.id,]
     c = UserFollowersCache(prekey=self.user.id)
     followers = c.get()
     if followers is None:
         follower_profiles = self.user.followers.all()
         followers = [profile.user for profile in follower_profiles]
         c.cache_store(followers)
     return followers