@cors_api_view(['GET'])
@permission_classes([AllowAny])
def site_config(request):
 def serialized_data(cls):
  as_list = cls(cls.Meta.model.objects.all().order_by('name'), many=True).data
  return dict(((d['name'], d) for d in as_list))
 if (request.GET.get('serializer') == 'commonplace'):
  data = {'waffle': {'switches': list(waffle.models.Switch.objects.filter(active=True).values_list('name', flat=True))}}
 else:
  data = {'settings': get_settings(), 'version': getattr(settings, 'BUILD_ID_JS', ''), 'waffle': {'switches': serialized_data(SwitchSerializer), 'flags': serialized_data(FlagSerializer)}}
 (fxa_auth_state, fxa_auth_url) = fxa_auth_info()
 data['fxa'] = {'fxa_auth_state': fxa_auth_state, 'fxa_auth_url': fxa_auth_url}
 return Response(data)

@ cors_api_view ( [ 'GET' ] ) @ permission_classes ( [ AllowAny ] ) def site_config ( request ) : def serialized_data ( cls ) : as_list = cls ( cls . Meta . model . objects . all ( ) . order_by ( 'name' ) , many = True ) . data return dict ( ( ( d [ 'name' ] , d ) for d in as_list ) ) if ( request . GET . get ( 'serializer' ) == 'commonplace' ) : data = { 'waffle' : { 'switches' : list ( waffle . models . Switch . objects . filter ( active = True ) . values_list ( 'name' , flat = True ) ) } } else : data = { 'settings' : get_settings ( ) , 'version' : getattr ( settings , 'BUILD_ID_JS' , '' ) , 'waffle' : { 'switches' : serialized_data ( SwitchSerializer ) , 'flags' : serialized_data ( FlagSerializer ) } } ( fxa_auth_state , fxa_auth_url ) = fxa_auth_info ( ) data [ 'fxa' ] = { 'fxa_auth_state' : fxa_auth_state , 'fxa_auth_url' : fxa_auth_url } return Response ( data )
a resource that is designed to be exposed externally and contains settings or waffle flags that might be relevant to the client app .