Skip to content

Commit

Permalink
Add __tablename__s and primary keys to models
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Bulash committed May 27, 2015
1 parent 6efab08 commit 430ac68
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions flask_swagger_codegen/templates/models.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ db = SQLAlchemy()


class {{ name }}(db.Model):
__tablename__ = '{{ name | lower }}s'
id = db.Column(db.Integer(), primary_key=True)
{%- for n, field in schema.fields.iteritems() %}
{{n}} = db.Column(db.{{ field | replace('fields.', '') }})
{%- endfor %}
Expand Down

0 comments on commit 430ac68

Please sign in to comment.