Exemplo n.º 1
0
    def get(self, user_id=None):
        user_id = user_id or self.current_user['_id']

        kwargs = yield self.get_header_arguments(user_id)
        if not kwargs['can_seen']:
            self.render('profile/template/profile-visitor.html', **kwargs)
        else:
            status_list = yield StatusDocument.get_status_list(
                user_id,
                self.current_user['_id'],
                limit=PROFILE_SETTINGS['status_number_per_page'])

            recommend_friend_list = yield UserDocument.get_random_user_list(
                self.current_user['_id'])

            if kwargs['user']['user_type'] == 'league':
                member_list = yield LeagueMemberDocument.get_member(user_id)
                kwargs.update({'member_list': member_list})

            kwargs.update({
                'status_list': status_list,
                'recommend_friend_list': recommend_friend_list,
                'PROFILE_SETTINGS': PROFILE_SETTINGS
            })

            self.render('profile/template/status/status.html', **kwargs)
Exemplo n.º 2
0
    def get(self, user_id=None):
        user_id = user_id or self.current_user['_id']

        kwargs = yield self.get_header_arguments(user_id)
        if not kwargs['can_seen']:
            self.render('profile/template/profile-visitor.html', **kwargs)
        else:
            status_list = yield StatusDocument.get_status_list(
                user_id,
                self.current_user['_id'],
                limit=PROFILE_SETTINGS['status_number_per_page']
            )

            recommend_friend_list = yield UserDocument.get_random_user_list(
                self.current_user['_id']
            )

            if kwargs['user']['user_type'] == 'league':
                member_list = yield LeagueMemberDocument.get_member(user_id)
                kwargs.update({'member_list': member_list})

            kwargs.update({
                'status_list': status_list,
                'recommend_friend_list': recommend_friend_list,
                'PROFILE_SETTINGS': PROFILE_SETTINGS
            })

            self.render('profile/template/status/status.html', **kwargs)
Exemplo n.º 3
0
    def post(self):
        form = StatusMoreForm(self.request.arguments)
        if not form.validate():
            raise HTTPError(404)

        page = form.page.data

        skip = PROFILE_SETTINGS['status_number_per_page'] * page
        limit = PROFILE_SETTINGS['status_number_per_page']
        status_list = yield StatusDocument.get_status_list(
            self.current_user['_id'],
            self.current_user['_id'],
            skip=skip,
            limit=limit)

        html = ''.join(
            self.render_string('profile/template/status/status-list-item.html',
                               status=status) for status in status_list)

        self.finish(json.dumps({'html': html, 'page': page + 1}))
Exemplo n.º 4
0
    def post(self):
        form = StatusMoreForm(self.request.arguments)
        if not form.validate():
            raise HTTPError(404)

        page = form.page.data

        skip = PROFILE_SETTINGS['status_number_per_page'] * page
        limit = PROFILE_SETTINGS['status_number_per_page']
        status_list = yield StatusDocument.get_status_list(
            self.current_user['_id'],
            self.current_user['_id'],
            skip=skip, limit=limit
        )

        html = ''.join(
            self.render_string(
                'profile/template/status/status-list-item.html',
                status=status
            ) for status in status_list
        )
        self.write_json({'html': html, 'page': page + 1})