-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmodels.py
46 lines (30 loc) · 1.1 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from routes import db
import json
class User(db.Model):
__tablename__ = 'users'
# Serial Number
sno = db.Column(db.Integer, primary_key = True)
# Organisation
organisation = db.Column(db.String(128), nullable=False)
# User Name
name = db.Column(db.String(128), nullable=False)
# Github username
github_username = db.Column(db.String(128), nullable = False)
# New instance instantiation procedure
def __init__(self, organisation, name, github_username):
self.organisation = organisation
self.name = name
self.github_username = github_username
def __repr__(self):
return json.dumps([self.name, self.github_username])
class Organisation(db.Model):
__tablename__ = 'organisations'
# Serial Number
sno = db.Column(db.Integer, primary_key = True)
# Organisation
organisation = db.Column(db.String(128), nullable=False)
# New instance instantiation procedure
def __init__(self, organisation):
self.organisation = organisation
def __repr__(self):
return json.dumps([self.organisation])