def delete(self):
ret = False<EOL>q = self.query<EOL>pk = self.pk<EOL>if pk:<EOL><INDENT>pk_name = self.schema.pk.name<EOL>self.query.is_field(pk_name, pk).delete()<EOL>setattr(self, pk_name, None)<EOL>self.reset_modified()<EOL>for field_name in self.schema.fields:<EOL><INDENT>if getattr(self, field_name, None) != None:<EOL><INDENT>self.modified_fields.add(field_name)<EOL><DEDENT><DEDENT>ret = True<EOL><DEDENT>return ret<EOL>
delete the object from the db if pk is set