#NEWLINE# def filter_queryset( self , qs , user ) : #NEWLINE# #INDENT# qs_filter = Q ( project__isnull = True , goal__isnull = True ) #NEWLINE# qs_filter |= Q ( employee = ( user . djangobmf . employee or ( - 1 ) ) ) #NEWLINE# qs_filter |= Q ( in_charge = user . djangobmf . employee ) #NEWLINE# if hasattr ( qs . model , 'goal' ) : #NEWLINE# #INDENT# goal = qs . model . _meta . get_field_by_name ( 'goal' ) [ 0 ] . model #NEWLINE# if user . has_perm ( ( '%s.can_manage' % goal . _meta . app_label ) , goal ) : #NEWLINE# #INDENT# qs_filter |= Q ( goal__isnull = False ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# qs_filter |= Q ( goal__isnull = False , goal__referee = ( user . djangobmf . employee or ( - 1 ) ) ) #NEWLINE# qs_filter |= Q ( goal__isnull = False , goal__employees = ( qs . djangobmf . employee or ( - 1 ) ) ) #NEWLINE# qs_filter |= Q ( goal__isnull = False , goal__team__in = user . djangobmf . team ) #NEWLINE# #UNINDENT# #UNINDENT# if hasattr ( qs . model , 'project' ) : #NEWLINE# #INDENT# project = qs . model . _meta . get_field_by_name ( 'project' ) [ 0 ] . model #NEWLINE# if user . has_perm ( ( '%s.can_manage' % project . _meta . app_label ) , project ) : #NEWLINE# #INDENT# qs_filter |= Q ( project__isnull = False ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# qs_filter |= Q ( project__isnull = False , project__employees = ( user . djangobmf . employee or ( - 1 ) ) ) #NEWLINE# qs_filter |= Q ( project__isnull = False , project__team__in = user . djangobmf . team ) #NEWLINE# #UNINDENT# #UNINDENT# return qs . filter ( qs_filter )