fixes for #270 and #274

This commit is contained in:
collerek
2021-07-21 14:39:23 +02:00
parent 5e0f704864
commit b423c1c56d
6 changed files with 100 additions and 19 deletions

View File

@ -76,7 +76,7 @@ class UndefinedType: # pragma no cover
Undefined = UndefinedType()
__version__ = "0.10.14"
__version__ = "0.10.15"
__all__ = [
"Integer",
"BigInteger",

View File

@ -152,7 +152,7 @@ def sqlalchemy_columns_from_model_fields(
if len(model_fields.keys()) == 0:
model_fields["id"] = ormar.Integer(name="id", primary_key=True)
logging.warning(
"Table {table_name} had no fields so auto "
f"Table {new_model.Meta.tablename} had no fields so auto "
"Integer primary key named `id` created."
)
validate_related_names_in_relations(model_fields, new_model)

View File

@ -121,7 +121,7 @@ class SavePrepareMixin(RelationMixin, AliasMixin):
f"model without pk set!"
)
model_dict[field] = pk_value
elif field_value: # nested dict
elif isinstance(field_value, (list, dict)) and field_value:
if isinstance(field_value, list):
model_dict[field] = [
target.get(target_pkname) for target in field_value