def save(self):
try:
super(Orm, self).save()
except UniqueError as e:
pk_name = self.schema.pk_name
if pk_name and (pk_name in self.modified_fields):
self.update()
else:
raise
It would be great to have a more robust version, that catches the unique error, pulls out the fields, then sets those fields in a where portion of a Query and tries the update.
We have a version of save that's like this:
It would be great to have a more robust version, that catches the unique error, pulls out the fields, then sets those fields in a where portion of a Query and tries the update.