Skip to content

Commit

Permalink
Fix bug in pydantic_model_creator when include is set (#1683)
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdeldjalil-H committed Aug 5, 2024
1 parent 1353ac1 commit 5ca0c5f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ Changelog
0.21
====

0.21.6
------
Fixed
^^^^^
- Fix bug in `pydantic_model_creator` when a foreign key is not included in `include` param. (#1430)

0.21.5 <../0.21.5>`_ - 2024-07-18
------
Added
Expand Down
2 changes: 1 addition & 1 deletion tortoise/contrib/pydantic/creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def field_map_update(keys: tuple, is_relation=True) -> None:
# Remove raw fields
raw_field = fd.get("raw_field", None)
if raw_field is not None and exclude_raw_fields and raw_field != pk_raw_field:
del field_map[raw_field]
field_map.pop(raw_field, None)
field_map[n] = fd

# Update field definitions from description
Expand Down

0 comments on commit 5ca0c5f

Please sign in to comment.