#NEWLINE# def remove_perm( self , perm , user , obj ) : #NEWLINE# #INDENT# '\n        Removes permission ``perm`` for an instance ``obj`` and given ``user``.\n        ' #NEWLINE# if ( getattr ( obj , 'pk' , None ) is None ) : #NEWLINE# #INDENT# raise Exception ( ( 'Object %s needs to be persisted first' % self ) ) #NEWLINE# #UNINDENT# filters = { #NEWLINE# #INDENT# 'permission__codename' : perm , #NEWLINE# 'permission__content_type' : ContentType . objects . get_for_model ( obj ) , #NEWLINE# 'user' : user , #NEWLINE# #UNINDENT# } #NEWLINE# filters [ 'object_pk' ] = obj . pk #NEWLINE# self . filter ( ** filters ) . delete ( )