Skip to content

Commit 13ca751

Browse files
Use is_stored for model selection
1 parent b804273 commit 13ca751

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/aiida/orm/entities.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def orm_to_model_field_values(
311311
"""
312312
fields: dict[str, Any] = {}
313313

314-
Model = self.Model if self.pk else self.CreateModel # noqa: N806
314+
Model = self.Model if self.is_stored else self.CreateModel # noqa: N806
315315

316316
for key, field in Model.model_fields.items():
317317
if (skip_read_only and get_metadata(field, 'exclude_to_orm')) or key == 'extras':
@@ -346,7 +346,7 @@ def to_model(
346346
repository_path=repository_path,
347347
serialize_repository_content=serialize_repository_content,
348348
)
349-
Model = self.Model if self.pk else self.CreateModel # noqa: N806
349+
Model = self.Model if self.is_stored else self.CreateModel # noqa: N806
350350
return Model(**fields)
351351

352352
@classmethod

0 commit comments

Comments
 (0)