#NEWLINE# def media_js( self , request ) : #NEWLINE# #INDENT# from allauth.socialaccount.models import SocialApp #NEWLINE# locale = self . get_locale_for_request ( request ) #NEWLINE# try : #NEWLINE# #INDENT# app = self . get_app ( request ) #NEWLINE# #UNINDENT# except SocialApp . DoesNotExist : #NEWLINE# #INDENT# raise ImproperlyConfigured ( 'No Facebook app configured: please add a SocialApp using the Django admin' ) #NEWLINE# #UNINDENT# def abs_uri( name ) : #NEWLINE# #INDENT# return request . build_absolute_uri ( reverse ( name ) ) #NEWLINE# #UNINDENT# fb_data = { #NEWLINE# #INDENT# 'appId' : app . client_id , #NEWLINE# 'version' : GRAPH_API_VERSION , #NEWLINE# 'locale' : locale , #NEWLINE# 'loginOptions' : self . get_fb_login_options ( request ) , #NEWLINE# 'loginByTokenUrl' : abs_uri ( 'facebook_login_by_token' ) , #NEWLINE# 'cancelUrl' : abs_uri ( 'socialaccount_login_cancelled' ) , #NEWLINE# 'logoutUrl' : abs_uri ( 'account_logout' ) , #NEWLINE# 'loginUrl' : request . build_absolute_uri ( self . get_login_url ( request , method = 'oauth2' ) ) , #NEWLINE# 'errorUrl' : abs_uri ( 'socialaccount_login_error' ) , #NEWLINE# 'csrfToken' : get_token ( request ) , #NEWLINE# #UNINDENT# } #NEWLINE# ctx = { #NEWLINE# #INDENT# 'fb_data' : mark_safe ( json . dumps ( fb_data ) ) , #NEWLINE# #UNINDENT# } #NEWLINE# return render_to_string ( 'facebook/fbconnect.html' , ctx , request = request )