#NEWLINE# def user_has_any_permission_for_instance( self , user , actions , instance ) : #NEWLINE# #INDENT# if ( ( 'change' in actions ) or ( 'delete' in actions ) ) : #NEWLINE# #INDENT# if user . has_perm ( self . _get_permission_name ( 'change' ) ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( user . has_perm ( self . _get_permission_name ( 'add' ) ) and ( getattr ( instance , self . owner_field_name ) == self ) ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# return ( user . is_active and user . is_superuser )