<s> from django . views . generic import DetailView <EOL> from . models import Page <EOL> class PageView ( DetailView ) : <EOL> template_name = '<STR_LIT>' <EOL> template_name_field = '<STR_LIT>' <EOL> context_object_name = '<STR_LIT>' <EOL> slug_url_kwarg = '<STR_LIT:path>' <EOL> slug_field = '<STR_LIT:path>' <EOL> def get_template_names ( self ) : <EOL> """<STR_LIT>""" <EOL> names = [ self . template_name ] <EOL> if self . object and self . template_name_field : <EOL> name = getattr ( self . object , self . template_name_field , None ) <EOL> if name : <EOL> names . insert ( <NUM_LIT:0> , name ) <EOL> return names <EOL> def get_queryset ( self ) : <EOL> if self . request . user . is_staff : <EOL> return Page . objects . all ( ) <EOL> else : <EOL> return Page . objects . published ( ) <EOL> @ property <EOL> def content_type ( self ) : <EOL> return self . object . content_type <EOL> def get_extra_context ( self , * args , ** kwargs ) : <EOL> context = self . super ( ) . get_extra_context ( * args , ** kwargs ) <EOL> context [ '<STR_LIT>' ] = True <EOL> return context </s>
