def get_youtube_data_ajax(request, username, child_slug): keywords = comma_split(request.GET['keywords']) usernames = comma_split(request.GET['usernames']) youtube_events = [] for username in usernames: youtube_events += youtube.list_videos(username) youtube_events = keywords_present(youtube_events, keywords, lambda video: video.title) youtube_events = [YouTubeEvent(e) for e in youtube_events] return render(request, 'profiles/youtube_data.html', {'youtube_events': youtube_events})
def get_facebook_data_ajax(request, username, child_slug): child = get_object_or_404(Child, user__username=username, slug=child_slug) keywords = comma_split(request.GET['keywords']) print keywords facebook_events = [] for source in child.facebook_sources.all(): facebook_events += facebook.list_posts(source.access_token) facebook_events = keywords_present(facebook_events, keywords, facebook.post_text) facebook_events = [FacebookEvent(e) for e in facebook_events] return render(request, 'profiles/facebook_data.html', {'facebook_events': facebook_events})