コード例 #1
0
ファイル: models.py プロジェクト: yacine15/django-htk
 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()
コード例 #2
0
ファイル: models.py プロジェクト: PocketGM/django-htk
 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()
コード例 #3
0
ファイル: models.py プロジェクト: PocketGM/django-htk
 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
コード例 #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