コード例 #1
0
ファイル: managers.py プロジェクト: cheetos007/owantsbeta_git
    def latest_pins_for_user(self, user, category=None):
        user = getattr(user, "pk", user)
        followed_users = follow.get_user_following(user)
        unfollowed_boards = follow.get_user_unfollowed_boards(user)
        followed_boards = follow.get_user_followed_boards(user)

        query_params = (
            Q(video_id="") & Q(is_active=True) & Q(board__is_active=True) & Q(board__category__is_active=True)
        )
        query_params = query_params & ~Q(board__in=unfollowed_boards)
        board_params = Q(board__user__in=followed_users) | Q(board__in=followed_boards)

        qs = self.filter(query_params & board_params)

        qs = qs.select_related("board", "domain", "board__category", "source_pin", "board__user", "created_user")

        if category:
            qs = qs.filter(board__category=category)
        return qs
コード例 #2
0
ファイル: managers.py プロジェクト: rohitkush1/owantsbeta_git
    def latest_pins_for_user(self, user, category=None):
        user = getattr(user, 'pk', user)
        followed_users = follow.get_user_following(user)
        unfollowed_boards = follow.get_user_unfollowed_boards(user)
        followed_boards = follow.get_user_followed_boards(user)

        query_params = Q(video_id='') & Q(is_active=True) & Q(
            board__is_active=True) & Q(board__category__is_active=True)
        query_params = query_params & ~Q(board__in=unfollowed_boards)
        board_params = Q(board__user__in=followed_users) | Q(
            board__in=followed_boards)

        qs = self.filter(query_params & board_params)

        qs = qs.select_related('board', 'domain', 'board__category',
                               'source_pin', 'board__user', 'created_user')

        if category:
            qs = qs.filter(board__category=category)
        return qs
コード例 #3
0
ファイル: views.py プロジェクト: rohitkush1/owantsbeta_git
def following_users_list(request):
	user_list = User.objects.filter(pk__in=follow.get_user_following(request.user.pk))
	profile = request.user.get_profile()
	return direct_to_template(request, 'profiles/follow/following_users.html', locals())
コード例 #4
0
def number_of_following(user):
	return len(follow.get_user_following(user.pk))
コード例 #5
0
def number_of_following(user):
    return len(follow.get_user_following(user.pk))