diff --git a/flask_swagger_codegen/templates/models.py.j2 b/flask_swagger_codegen/templates/models.py.j2 index 74bef11..0b33682 100644 --- a/flask_swagger_codegen/templates/models.py.j2 +++ b/flask_swagger_codegen/templates/models.py.j2 @@ -4,7 +4,6 @@ # models are for SQL-alchemy -from marshmallow import fields from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() @@ -14,7 +13,7 @@ db = SQLAlchemy() class {{ name }}(db.Model): {%- for n, field in schema.fields.iteritems() %} - {{n}} = db.Column(db.{{ field }}) + {{n}} = db.Column(db.{{ field | replace('fields.', '') }}) {%- endfor %} {%- endfor %}