diff options
author | Navan Chauhan <navanchauhan@gmail.com> | 2021-06-03 22:49:20 +0530 |
---|---|---|
committer | Navan Chauhan <navanchauhan@gmail.com> | 2021-06-03 22:49:20 +0530 |
commit | 5525ecf681b83f2393dfda458d39f562ee3eba09 (patch) | |
tree | f7c155894bbfae39170949238ef7e495ea758d71 /app | |
parent | 38e88864c880ea5ffc35f2ed2f0a35d8ce8397f9 (diff) |
moved user db model to seperate file
Diffstat (limited to 'app')
-rw-r--r-- | app/__init__.py | 8 | ||||
-rw-r--r-- | app/models.py | 7 |
2 files changed, 8 insertions, 7 deletions
diff --git a/app/__init__.py b/app/__init__.py index dad9ba0..7145f96 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -10,13 +10,7 @@ app.config.from_object('app.config') bcrypt = Bcrypt(app) db = SQLAlchemy(app) -class User(db.Model): - id = db.Column(db.Integer, primary_key=True) - username = db.Column(db.String(80), unique=True, nullable=False) - email = db.Column(db.String(120), unique=True, nullable=False) - - def __repr__(self): - return '<User %r>' % self.username +from app.models import User database_cli = AppGroup("database") @database_cli.command("create") diff --git a/app/models.py b/app/models.py new file mode 100644 index 0000000..2734921 --- /dev/null +++ b/app/models.py @@ -0,0 +1,7 @@ +class User(db.Model): + id = db.Column(db.Integer, primary_key=True) + username = db.Column(db.String(80), unique=True, nullable=False) + email = db.Column(db.String(120), unique=True, nullable=False) + + def __repr__(self): + return '<User %r>' % self.username
\ No newline at end of file |