def choose_show_guest(request): following = request.GET['following'].split(",") show_data = shows.get_show_by_id(request.GET['showid'], None) if "showid" in show_data and str(show_data["showid"]) in following: show_data = {"do_nothing": True} data = simplejson.dumps(show_data) return HttpResponse(data, mimetype='application/json')
def follow_show(request): show_data = None user = _validate_token(request) if user: showid = int(request.GET.get('showid', 0)) show_data = shows.get_show_by_id(showid, user, client=True) shows.follow_show(showid, user) data = simplejson.dumps(show_data) return HttpResponse(data, mimetype='application/json')
def rpc_guest_load(request): following = request.GET['following'].split(",") shows_info = [] for val in following: if val.isdigit(): show_data = shows.get_show_by_id(val, None) shows_info.append(show_data) data = simplejson.dumps(shows_info) return HttpResponse(data, mimetype='application/json')
def home(request): """Home Page.""" if request.session.get('new_user', False): shows_info = request.session["from_guest"] for val in shows_info: if val.isdigit(): shows.get_show_by_id(val, request.user) shows_filter = '' if 'shows' in request.GET: shows_filter = request.GET['shows'] request.session['filter'] = shows_filter elif request.session.get('filter', False): shows_filter = request.session['filter'] else: shows_filter = 'all' data = shows.get_shows_per_user(request.user, shows_filter) most_rated = shows.get_most_rated_shows(request.user) data['recommended'] = most_rated data['filter'] = shows_filter return render_response(request, 'index.html', data)
def choose_show(request): show_data = shows.get_show_by_id(request.GET['showid'], request.user) data = simplejson.dumps(show_data) return HttpResponse(data, mimetype='application/json')