<s> from django . views . generic . detail import DetailView <EOL> from django . views . generic . list import ListView <EOL> from tumblelog . models import Post <EOL> from tumblelog . settings import POSTS_PER_PAGE <EOL> class PostListView ( ListView ) : <EOL> context_object_name = '<STR_LIT>' <EOL> paginate_by = POSTS_PER_PAGE <EOL> def get_queryset ( self ) : <EOL> return Post . objects . public ( ) . select_generic_related ( ) <EOL> def get_context_data ( self , ** kwargs ) : <EOL> context = super ( PostListView , self ) . get_context_data ( ** kwargs ) <EOL> context . update ( { <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : False , <EOL> } ) <EOL> return context <EOL> class PostDetailView ( DetailView ) : <EOL> context_object_name = '<STR_LIT>' <EOL> def get_queryset ( self ) : <EOL> return Post . objects . public ( ) . select_generic_related ( ) <EOL> def get_context_data ( self , ** kwargs ) : <EOL> context = super ( PostDetailView , self ) . get_context_data ( ** kwargs ) <EOL> context . update ( { <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : True , <EOL> } ) <EOL> return context </s>
