13 lines
1.0 KiB
Plaintext
13 lines
1.0 KiB
Plaintext
|
|
[%- if not column.multiple %]
|
|
[[ column.name ]]_id = db.Column(db.Integer, db.ForeignKey('[%- if column.to %][[ column.to|camel_to_snake ]][%- else %][[ column.name ]][% endif %].id'))
|
|
[%- endif %]
|
|
[[ column.name|pluralize if column.multiple else column.name ]] = db.relationship('[%- if column.to %][[ column.to ]][%- else %][[ column.name|snake_to_camel ]][% endif %]',
|
|
[%- if column.multiple %]secondary=[[ column.secondary.name ]], [%- endif %]
|
|
backref=db.backref("[%- if column.backref %][[ column.backref ]][%- else %][[ name|camel_to_snake|pluralize ]][%- endif %]"),
|
|
[%- if column.foreign_keys %]foreign_keys=[ [[ column.foreign_keys ]]_id],[%- endif %]
|
|
)
|
|
[%- if column.multiple %]
|
|
|
|
_m_n_table_[[ column.name|pluralize ]] = '[%- if column.to %][[ column.to ]][%- else %][[ column.name|snake_to_camel ]][% endif %]'
|
|
[%- endif %] |