#NEWLINE# def get_queryset( self ) : #NEWLINE# #INDENT# queryset = Account . objects . all ( ) #NEWLINE# if ( 'code' not in self . request . GET ) : #NEWLINE# #INDENT# self . form = self . form_class ( ) #NEWLINE# return queryset #NEWLINE# #UNINDENT# self . form = self . form_class ( self . request . GET ) #NEWLINE# if ( not self . form . is_valid ( ) ) : #NEWLINE# #INDENT# return queryset #NEWLINE# #UNINDENT# data = self . form . cleaned_data #NEWLINE# desc_template = _ ( '%(status)s %(unit)ss %(code_filter)s %(name_filter)s' ) #NEWLINE# desc_ctx = { #NEWLINE# #INDENT# 'unit' : names . UNIT_NAME . lower ( ) , #NEWLINE# 'status' : 'All' , #NEWLINE# 'code_filter' : '' , #NEWLINE# 'name_filter' : '' , #NEWLINE# #UNINDENT# } #NEWLINE# if data [ 'name' ] : #NEWLINE# #INDENT# queryset = queryset . filter ( name__icontains = data [ 'name' ] ) #NEWLINE# desc_ctx [ 'name_filter' ] = ( _ ( " with name matching '%s'" ) % data [ 'name' ] ) #NEWLINE# #UNINDENT# if data [ 'code' ] : #NEWLINE# #INDENT# queryset = queryset . filter ( code = data [ 'code' ] ) #NEWLINE# desc_ctx [ 'code_filter' ] = ( _ ( " with code '%s'" ) % data [ 'code' ] ) #NEWLINE# #UNINDENT# if data [ 'status' ] : #NEWLINE# #INDENT# queryset = queryset . filter ( status = data [ 'status' ] ) #NEWLINE# desc_ctx [ 'status' ] = data [ 'status' ] #NEWLINE# #UNINDENT# self . description = ( desc_template % data ) #NEWLINE# return queryset