oshipka/vm_gen/templates/model_py

18 lines
518 B
Plaintext
Raw Normal View History

2020-06-03 16:00:51 +02:00
[%- 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 %]