<s> from django . views . generic import TemplateView <EOL> from hyperadmin . clients . views . common import ClientMixin <EOL> class SingleObjectMixin ( object ) : <EOL> context_object_name = None <EOL> def get_resource_item ( self ) : <EOL> return self . get_state ( ) . item <EOL> def get_object ( self ) : <EOL> return self . get_resource_item ( ) . instance <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:object>' <EOL> def get_context_data ( self , ** kwargs ) : <EOL> context = super ( SingleObjectMixin , self ) . get_context_data ( ** kwargs ) <EOL> context_object_name = self . get_context_object_name ( ) <EOL> context [ context_object_name ] = self . get_object ( ) <EOL> context [ '<STR_LIT>' ] = self . get_resource_item ( ) <EOL> return context <EOL> class DetailView ( SingleObjectMixin , ClientMixin , TemplateView ) : <EOL> view_classes = [ '<STR_LIT>' ] <EOL> def get_context_data ( self , ** kwargs ) : <EOL> context = super ( DetailView , self ) . get_context_data ( ** kwargs ) <EOL> return context </s>
