#NEWLINE# def index( request ) : #NEWLINE# #INDENT# '\n    Page shell for the client-side application.\n\n    Bootstraps read-once data onto the page.\n    ' #NEWLINE# serializer = Serializer ( ) #NEWLINE# cr = CategoryResource ( ) #NEWLINE# categories = list ( Category . objects . annotate ( dataset_count = Count ( 'datasets' ) ) ) #NEWLINE# bundles = [ cr . build_bundle ( obj = uncategorized_bundle ) for c in categories ] #NEWLINE# categories_bootstrap = [ cr . full_dehydrate ( b ) for b in bundles ] #NEWLINE# uncategorized = Category ( id = settings . PANDA_UNCATEGORIZED_ID , slug = settings . PANDA_UNCATEGORIZED_SLUG , name = settings . PANDA_UNCATEGORIZED_NAME ) #NEWLINE# uncategorized . __dict__ [ 'dataset_count' ] = Dataset . objects . filter ( categories = None ) . count ( ) #NEWLINE# uncategorized_bundle = cr . full_dehydrate ( cr . build_bundle ( obj = uncategorized ) ) #NEWLINE# categories_bootstrap . append ( uncategorized_bundle ) #NEWLINE# return render_to_response ( 'index.html' , { #NEWLINE# #INDENT# 'settings' : settings , #NEWLINE# 'warn_upload_size' : int ( config_value ( 'MISC' , 'WARN_UPLOAD_SIZE' ) ) , #NEWLINE# 'max_upload_size' : int ( config_value ( 'MISC' , 'MAX_UPLOAD_SIZE' ) ) , #NEWLINE# 'email_enabled' : int ( config_value ( 'EMAIL' , 'EMAIL_ENABLED' ) ) , #NEWLINE# 'demo_mode_enabled' : int ( config_value ( 'MISC' , 'DEMO_MODE_ENABLED' ) ) , #NEWLINE# 'bootstrap_data' : serializer . to_json ( { #NEWLINE# #INDENT# 'categories' : categories_bootstrap , #NEWLINE# #UNINDENT# } ) , #NEWLINE# 'moment_lang_code' : settings . MOMENT_LANGUAGE_MAPPING . get ( settings . LANGUAGE_CODE , None ) , #NEWLINE# #UNINDENT# } )