Describe the bug
In a belongs to many relationship, the table option can't be without an underscore (i.e. compositions), but it should be table1_table2. If this structure isn't present it throws an error when splitting the table name. This behaviour isn't necessary when local_foreign_key and other_foreign_key are set.
To Reproduce
Steps to reproduce the behavior:
Create a sample database with two tables and one "belongstomany" table
Create the models for the table
Use the code below for the "belongs to many" relationship
Try to get the related model & see error
Expected behavior
Table works with the two additional options
Screenshots or code snippets
@belongs_to_many(local_foreign_key="donut_id", other_foreign_key="", pivot_id=None, table="compositions", with_fields=["absolute_quantity"])
def ingredients(self):
"""Get the ingredients for this donut"""
from app.Models.Ingredient import Ingredient
return Ingredient
Desktop (please complete the following information):
Describe the bug In a belongs to many relationship, the table option can't be without an underscore (i.e.
compositions
), but it should betable1_table2
. If this structure isn't present it throws an error when splitting the table name. This behaviour isn't necessary whenlocal_foreign_key
andother_foreign_key
are set.To Reproduce Steps to reproduce the behavior:
Expected behavior Table works with the two additional options
Screenshots or code snippets
Desktop (please complete the following information):
What database are you using?