Issue : Incorrect table name used in `Foreign` class.
Open
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
The `Foreign` class uses `obj.table_name` to build a foreign key. However, `obj` is an instance of a Model (e.g., `Post` or `Comment`), which doesn't necessarily have a `table_name` attribute directly accessible. It should be accessing the table name through the class of the object (`obj.__class__.table_name`). While it might work in some cases due to the way `__getattr__` is implemented, it's not the correct and reliable way to access the table name. The fix is to use the `obj.__class__.table_name` instead of `obj.table_name`.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.