<s> from django . db import models <EOL> from django . shortcuts import get_object_or_404 , render_to_response <EOL> from django . template import RequestContext <EOL> from django . views . generic . list_detail import object_list , object_detail <EOL> Page = models . get_model ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> def page_list ( request ) : <EOL> page_list = Page . objects . all ( ) <EOL> return object_list ( request , queryset = page_list ) <EOL> def published_page ( request , slug ) : <EOL> slug_field = slug <EOL> published_page = Page . objects . filter ( status = '<STR_LIT>' ) <EOL> return object_detail ( request , slug = slug_field , queryset = published_page ) <EOL> def detail ( request , slug ) : <EOL> page = get_object_or_404 ( Page , slug = slug ) <EOL> template = page . template or '<STR_LIT>' <EOL> return render_to_response ( <EOL> template , <EOL> { '<STR_LIT:object>' : page } , <EOL> context_instance = RequestContext ( request ) <EOL> ) <EOL> def home ( request ) : <EOL> try : <EOL> home = Page . published_objects . get ( is_home = True ) <EOL> except Page . DoesNotExist : <EOL> home = None <EOL> return render_to_response ( <EOL> '<STR_LIT>' , <EOL> { '<STR_LIT>' : home , } , <EOL> context_instance = RequestContext ( request ) <EOL> ) </s>
