# Application models
#
# Copyright (c) 2016, Alexandre Hamelin <alexandre.hamelin gmail.com>


import os, os.path
from datetime import datetime
from flask.ext.sqlalchemy import SQLAlchemy
from {{PROJECTNAME}} import app


app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///{}'.format(
    os.path.join(app.root_path, app.name + '.db'))

db = SQLAlchemy(app)


#class MyModel(db.Model):
#    id = db.Column(db.Integer, primary_key=True)
#    # Quickref:
#    # types: Integer, String(L), Text, DateTime, ForeignKey('table.col')
#    # keywords: primary_key, nullable, unique, default
#    # rels: db.relationship('OtherModel', backref=db.backref('mymodels'))
#
#
#    def __init__(self, ...):
#        pass
#
#
#    def __str__(self):
#        return self.name
#
#
#    def __repr__(self):
#        return '<{} {!r}>'.format(self.__class__.__name__, self.id)

@@ -588,16 +588,32 @@
  # rels:
+%0A#    #  other =
  db.rela
@@ -638,37 +638,158 @@
 el',
- backref=db.backref('mymodels
+%0A#    #                          backref=db.backref('mymodels', lazy='dynamic'))%0A#    #  other_id = db.Column(db.Integer, db.ForeignKey('othermodel.id
 '))%0A

include examples for foreign keys