#NEWLINE# def extra_context( self ) : #NEWLINE# #INDENT# extra = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# extra [ 'request' ] = self . request #NEWLINE# ( paginator , page ) = self . build_page ( ) #NEWLINE# extra [ 'page' ] = page #NEWLINE# extra [ 'paginator' ] = paginator #NEWLINE# extra [ 'query' ] = self . request . GET . get ( 'q' , '' ) #NEWLINE# if isinstance ( self . queryset , EmptySearchQuerySet ) : #NEWLINE# #INDENT# extra [ 'facets_citation' ] = 0 #NEWLINE# extra [ 'facets_authority' ] = 0 #NEWLINE# extra [ 'count_citation' ] = len ( self . queryset ) #NEWLINE# extra [ 'count_authority' ] = len ( self . queryset ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# extra [ 'facets_authority' ] = self . queryset [ 'authority' ] . facet_counts ( ) #NEWLINE# extra [ 'facets_citation' ] = self . queryset [ 'citation' ] . facet_counts ( ) #NEWLINE# extra [ 'count_citation' ] = len ( self . queryset [ 'citation' ] ) #NEWLINE# extra [ 'count_authority' ] = len ( self . queryset [ 'authority' ] ) #NEWLINE# #UNINDENT# extra [ 'models' ] = self . request . GET . getlist ( 'models' ) #NEWLINE# extra [ 'sort_order_citation' ] = self . request . GET . get ( 'sort_order_citation' ) #NEWLINE# extra [ 'sort_order_authority' ] = self . request . GET . get ( 'sort_order_authority' ) #NEWLINE# extra [ 'sort_order_dir_citation' ] = self . request . GET . get ( 'sort_order_dir_citation' ) #NEWLINE# extra [ 'sort_order_dir_authority' ] = self . request . GET . get ( 'sort_order_dir_authority' ) #NEWLINE# if ( ( not extra [ 'sort_order_dir_citation' ] ) and ( ( not extra [ 'sort_order_citation' ] ) or ( 'publication_date_for_sort' in extra [ 'sort_order_citation' ] ) ) ) : #NEWLINE# #INDENT# extra [ 'sort_order_dir_citation' ] = 'descend' #NEWLINE# #UNINDENT# if ( not extra [ 'sort_order_dir_authority' ] ) : #NEWLINE# #INDENT# extra [ 'sort_order_dir_authority' ] = 'ascend' #NEWLINE# #UNINDENT# extra [ 'active' ] = 'home' #NEWLINE# facet_map = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# facets_raw = [ ] #NEWLINE# for facet in self . request . GET . getlist ( 'selected_facets' ) : #NEWLINE# #INDENT# if ( ':' not in facet ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# ( field , value ) = facet . split ( ':' , 1 ) #NEWLINE# if page : #NEWLINE# #INDENT# facet_map . setdefault ( field , [ ] ) . append ( value ) #NEWLINE# facets_raw . append ( ( ( field + ':' ) + quote ( codecs . encode ( value , 'utf-8' ) ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# extra [ 'selected_facets' ] = facet_map #NEWLINE# extra [ 'selected_facets_raw' ] = facets_raw #NEWLINE# return extra