#NEWLINE# def choice_detail( request , app_label , module_name , field_name , field_val , models ) : #NEWLINE# #INDENT# ( m , f ) = lookup_field ( app_label , module_name , field_name , models ) #NEWLINE# try : #NEWLINE# #INDENT# label = dict ( f . field . choices ) [ field_val ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# raise Http404 ( 'Invalid choice value given' ) #NEWLINE# #UNINDENT# obj_list = m . objects ( ** { #NEWLINE# #INDENT# f . field . name : field_val , #NEWLINE# #UNINDENT# } ) #NEWLINE# numitems = request . GET . get ( 'items' ) #NEWLINE# items_per_page = [ 25 , 50 , 100 ] #NEWLINE# if ( numitems and numitems . isdigit ( ) and ( int ( numitems ) > 0 ) ) : #NEWLINE# #INDENT# paginator = Paginator ( obj_list , numitems ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# paginator = Paginator ( obj_list , items_per_page [ 0 ] ) #NEWLINE# #UNINDENT# page = request . GET . get ( 'page' ) #NEWLINE# try : #NEWLINE# #INDENT# obj_list_page = paginator . page ( page ) #NEWLINE# #UNINDENT# except PageNotAnInteger : #NEWLINE# #INDENT# obj_list_page = paginator . page ( 1 ) #NEWLINE# #UNINDENT# except EmptyPage : #NEWLINE# #INDENT# obj_list_page = paginator . page ( paginator . num_pages ) #NEWLINE# #UNINDENT# return render_to_response ( 'databrowse/choice_detail.html' , { #NEWLINE# #INDENT# 'model' : m , #NEWLINE# 'field' : f , #NEWLINE# 'value' : label , #NEWLINE# 'object_list' : obj_list_page , #NEWLINE# 'items_per_page' : items_per_page , #NEWLINE# #UNINDENT# } )