Re: [sqlalchemy] Restrict update and delete based on attribute

2016-07-26 Thread Mike Bayer
On 07/26/2016 02:29 PM, drMental wrote: I'd like to restrict deletion and updates on an object based on the boolean attribute 'locked' on the same object. I've managed to successfully suppress updates but it doesn't seem to work for deletes with the following code. @listen_for(mapper, 'mapper

[sqlalchemy] Restrict update and delete based on attribute

2016-07-26 Thread drMental
I'd like to restrict deletion and updates on an object based on the boolean attribute 'locked' on the same object. I've managed to successfully suppress updates but it doesn't seem to work for deletes with the following code. @listen_for(mapper, 'mapper_configured') def mapper_configured(mapper