You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the UUIDPrimaryKeyMixin, all works well when creating new entries. However, when creating a new entry that already has an id, the UUIDPrimaryKeyMixin will ignore the provided UUID and replace it with a new one. This is not the behavior expected -- if I provide an id on creation, I do not expect it to be replaced.
In the file scopes/UUIDPrimaryKeyScope.py file, the following is a quick fix:
def set_uuid_create(self, builder):
# if there is already a primary key, no need to set a new one
if not builder._model.__primary_key__:
uuid_version = getattr(builder._model, "__uuid_version__", 4)
builder._creates.update(
{builder._model.__primary_key__: self.generate_uuid(builder, uuid_version)}
)
When using the UUIDPrimaryKeyMixin, all works well when creating new entries. However, when creating a new entry that already has an id, the UUIDPrimaryKeyMixin will ignore the provided UUID and replace it with a new one. This is not the behavior expected -- if I provide an id on creation, I do not expect it to be replaced.
In the file scopes/UUIDPrimaryKeyScope.py file, the following is a quick fix:
to replace:
The text was updated successfully, but these errors were encountered: