18 lines
518 B
Plaintext
18 lines
518 B
Plaintext
|
[%- if _choice_types %]
|
||
|
from sqlalchemy_utils import ChoiceType
|
||
|
[%- endif %]
|
||
|
|
||
|
from oshipka.persistance import db, ModelController
|
||
|
|
||
|
|
||
|
class [[ name ]](db.Model, ModelController):
|
||
|
[%- include "_model_choice_header_py" %]
|
||
|
|
||
|
[%- for column in columns %]
|
||
|
[%- if column._type == 'relationship' %]
|
||
|
[%- include "_relationship_py" %]
|
||
|
[%- else %]
|
||
|
[[ column.name ]] = db.Column([[ column._type ]][%- if column.default %], default="[[ column.default ]]"[%- endif %])
|
||
|
[%- endif %]
|
||
|
[%- endfor %]
|