#NEWLINE# def get_contents( self , tag ) : #NEWLINE# #INDENT# now = datetime . now ( ) #NEWLINE# filters = { #NEWLINE# #INDENT# 'published' : True , #NEWLINE# 'available_at__lte' : page , #NEWLINE# #UNINDENT# } #NEWLINE# contents = Content . objects ( ** filters ) . filter ( tags = tag ) #NEWLINE# self . tag = tag #NEWLINE# disabled_pagination = False #NEWLINE# if ( not current_app . config . get ( 'PAGINATION_ENABLED' , True ) ) : #NEWLINE# #INDENT# disabled_pagination = contents . count ( ) #NEWLINE# #UNINDENT# pagination_arg = current_app . config . get ( 'PAGINATION_ARG' , 'page' ) #NEWLINE# page = request . args . get ( pagination_arg , 1 ) #NEWLINE# per_page = ( disabled_pagination or request . args . get ( 'per_page' ) or current_app . config . get ( 'TAGS_PAGINATION_PER_PAGE' ) or current_app . config . get ( 'PAGINATION_PER_PAGE' , 10 ) ) #NEWLINE# contents = contents . paginate ( page = int ( page ) , per_page = per_page ) #NEWLINE# return contents