<s> from django . views . generic import TemplateView <EOL> from hyperadmin . clients . views . common import ClientMixin <EOL> class MultipleObjectMixin ( object ) : <EOL> context_object_name = None <EOL> def get_resource_items ( self ) : <EOL> return self . get_state ( ) . get_resource_items ( ) <EOL> def get_object_list ( self ) : <EOL> return [ ri . instance for ri in self . get_resource_items ( ) ] <EOL> def get_context_object_name ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . context_object_name : <EOL> return self . context_object_name <EOL> else : <EOL> return '<STR_LIT>' <EOL> def get_context_data ( self , ** kwargs ) : <EOL> context = super ( MultipleObjectMixin , self ) . get_context_data ( ** kwargs ) <EOL> context_object_name = self . get_context_object_name ( ) <EOL> context [ context_object_name ] = self . get_object_list ( ) <EOL> context [ '<STR_LIT>' ] = self . get_resource_items ( ) <EOL> return context <EOL> class ListView ( MultipleObjectMixin , ClientMixin , TemplateView ) : <EOL> view_classes = [ '<STR_LIT>' ] <EOL> def get_context_data ( self , ** kwargs ) : <EOL> context = super ( ListView , self ) . get_context_data ( ** kwargs ) <EOL> links = self . get_state ( ) . get_index_queries ( ) <EOL> context [ '<STR_LIT>' ] = [ link for link in links if link . rel == '<STR_LIT>' ] <EOL> filter_links = dict ( ) <EOL> for link in links : <EOL> if link . rel == '<STR_LIT>' : <EOL> section = link . cl_headers . get ( '<STR_LIT>' , link . prompt ) <EOL> filter_links . setdefault ( section , [ ] ) <EOL> filter_links [ section ] . append ( link ) <EOL> context [ '<STR_LIT>' ] = filter_links <EOL> return context </s>
