def get_signup_friends(request): fb_friends = False addr_friends = False if request.method == "POST": if "fb_friends" in request.POST: fb_friends = True elif "addr_friends" in request.POST: addr_friends = True response_dict = {} profile = request.user.get_profile() if fb_friends: current_fb_users_list = profile.run_getAppUsers_query() if current_fb_users_list is not None: current_fb_users_string = ','.join(current_fb_users_list) num_imported = run_fb_import(request) playdation_friend_users = profile.get_playdation_fb_friend_users( current_fb_users_list) json_list = create_list_of_parents_and_children( request, playdation_friend_users) response_dict.update({ 'success': True, 'playdation_friends': json_list, 'current_fb_users': current_fb_users_string }) else: # address book # noop if import already done.. (i think) status, error = run_import(request) playdation_friend_users = profile.get_playdation_contact_friend_users( ) json_list = create_list_of_parents_and_children( request, playdation_friend_users) response_dict.update({ 'success': True, 'playdation_friends': json_list }) # since we have the user on hold anyway, let's take the opportunity to populate their possible friends. for ac in profile.manage_playlist_children: populate_friend_suggestion(ac.child, request.user) return HttpResponse(simplejson.dumps(response_dict, cls=PDEncoder), mimetype='application/javascript')
def get_signup_friends(request): fb_friends = False addr_friends = False if request.method == "POST": if "fb_friends" in request.POST: fb_friends = True elif "addr_friends" in request.POST: addr_friends = True response_dict = {} profile = request.user.get_profile() if fb_friends: current_fb_users_list = profile.run_getAppUsers_query() if current_fb_users_list is not None: current_fb_users_string = ','.join(current_fb_users_list) num_imported = run_fb_import(request) playdation_friend_users = profile.get_playdation_fb_friend_users(current_fb_users_list) json_list = create_list_of_parents_and_children(request, playdation_friend_users) response_dict.update({ 'success': True, 'playdation_friends':json_list, 'current_fb_users':current_fb_users_string }) else: # address book # noop if import already done.. (i think) status, error = run_import(request) playdation_friend_users = profile.get_playdation_contact_friend_users() json_list = create_list_of_parents_and_children(request, playdation_friend_users) response_dict.update({ 'success': True, 'playdation_friends':json_list }) # since we have the user on hold anyway, let's take the opportunity to populate their possible friends. for ac in profile.manage_playlist_children: populate_friend_suggestion(ac.child, request.user) return HttpResponse(simplejson.dumps(response_dict, cls=PDEncoder), mimetype='application/javascript')
from django.core.management import setup_environ import sys sys.path.append('/var/www/playdation.net') sys.path.append('/var/www/playdation.net/playdation') sys.path.append('/var/www/playdation.net/playdation/apps') from playdation import settings setup_environ(settings) from profiles.models import Child, Adult_Child, Profile, FacebookUser from friends.models import Friendship, FriendshipInvitation from django.contrib.auth.models import User from friends.models import populate_friend_suggestion child_q = Child.objects.all() for child in child_q: populate_friend_suggestion(child)