2020-06-03 16:00:51 +02:00
|
|
|
|
2020-06-08 12:19:28 +02:00
|
|
|
[%- if not column.multiple %]
|
2020-06-03 18:11:37 +02:00
|
|
|
[[ column.name ]]_id = db.Column(db.Integer, db.ForeignKey('[%- if column.to %][[ column.to|camel_to_snake ]][%- else %][[ column.name ]][% endif %].id'))
|
|
|
|
[%- endif %]
|
2021-05-08 14:14:54 +02:00
|
|
|
[[ column.name|pluralize if column.multiple else column.name ]] = db.relationship('[%- if column.to %][[ column.to|snake_to_camel ]][%- else %][[ column.name|snake_to_camel ]][% endif %]',
|
2020-06-08 12:19:28 +02:00
|
|
|
[%- if column.multiple %]secondary=[[ column.secondary.name ]], [%- endif %]
|
2020-06-03 18:11:37 +02:00
|
|
|
backref=db.backref("[%- if column.backref %][[ column.backref ]][%- else %][[ name|camel_to_snake|pluralize ]][%- endif %]"),
|
2021-05-08 14:14:54 +02:00
|
|
|
[%- if column.foreign_key %]foreign_keys=[ [[ column.foreign_key ]]_id],[%- endif %]
|
2020-06-08 12:19:28 +02:00
|
|
|
)
|
|
|
|
[%- if column.multiple %]
|
|
|
|
|
|
|
|
_m_n_table_[[ column.name|pluralize ]] = '[%- if column.to %][[ column.to ]][%- else %][[ column.name|snake_to_camel ]][% endif %]'
|
|
|
|
[%- endif %]
|