Exemplo n.º 1
0
def explore(request):
    current = 'explore'
    feedAction = FeedAction()
    feedAction.set_user_position(request.user.id, PositionKey.EXPLORE)
    latest_feeds = feedAction.get_latest_feeds(0, 100)
    feeds_as_json = latest_feeds_as_json(request, latest_feeds)
    response_dictionary = {'current': current, 'feeds_as_json': feeds_as_json}
    return render_to_response('user/explore.html',
                              response_dictionary,
                              context_instance=RequestContext(request))
Exemplo n.º 2
0
def explore(request):
    repo_ids = get_hot_repo_ids()
    raw_repos = RepoManager.list_repo_by_ids(repo_ids)
    repos = [x for x in raw_repos if x.auth_type != 2]
    user_ids = [x.user_id for x in repos]
    users_dict = GsuserManager.map_users(user_ids)
    username_dict = dict([(users_dict[x]['id'], users_dict[x]['username']) for x in users_dict])
    userimgurl_dict = dict([(users_dict[x]['id'], users_dict[x]['imgurl']) for x in users_dict])

    feedAction = FeedAction()
    latest_feeds = feedAction.get_latest_feeds(0, 100)
    feeds_as_json = latest_feeds_as_json(request, latest_feeds)

    response_dictionary = {'repos': repos, 'users_dict': users_dict, 'username_dict': username_dict, 'userimgurl_dict': userimgurl_dict, 'feeds_as_json': feeds_as_json}
    return render_to_response('explore/explore.html',
                          response_dictionary,
                          context_instance=RequestContext(request))