Skip to content

Commit

Permalink
fixed getting relationship_definitions which would not properly be us…
Browse files Browse the repository at this point in the history
…ed if both models did not have a bdirectional Relationship ref, now works with dependent on single model ref (#44)

Co-authored-by: Joshua (codemation) <[email protected]>
  • Loading branch information
codemation and Joshua (codemation) authored Feb 3, 2023
1 parent b75b374 commit 8a156e2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pydbantic/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,9 @@ def generate_relationship_table(cls, related_model: DataBaseModel, field_ref: st

local_column = cls.__metadata__.tables[cls.__name__]['primary_key']
related_column = cls.__metadata__.tables[related_model.__name__]['primary_key']


relationship_definitions = cls.__metadata__.tables[name]['relationship_definitions'].get(related_model.__name__)

if relationship_definitions:
local_column = relationship_definitions['local_column']
related_column = relationship_definitions['related_column']
Expand Down

0 comments on commit 8a156e2

Please sign in to comment.