-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
65 lines (47 loc) · 2.48 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from flask_login import UserMixin, LoginManager
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class User(UserMixin, db.Model):
__tablename__ = 'User'
id = db.Column('ID', db.Integer, primary_key = True)
Username = db.Column('Username', db.String(40), unique = True, nullable = False)
Password = db.Column('Password', db.String(100), nullable = False)
ClientID = db.Column('ClientID', db.Integer, db.ForeignKey('Clients.ID'))
LawyerID = db.Column('LawyerID', db.Integer, db.ForeignKey('Lawyers.ID'))
JudgeID = db.Column('JudgeID', db.Integer, db.ForeignKey('Judges.ID'))
FirmID = db.Column('FirmID', db.Integer, db.ForeignKey('Firms.ID'))
class Client (db.Model):
__tablename__ = 'Clients'
ID = db.Column('ID', db.Integer, primary_key = True)
Name = db.Column('Name', db.String(30), nullable = False)
DOB = db.Column('DOB', db.Date, nullable = False)
class Lawyer (db.Model):
__tablename__ = 'Lawyers'
ID = db.Column('ID', db.Integer, primary_key = True)
Name = db.Column('Name', db.String(30), nullable = False)
AIBE = db.Column('AIBE', db.Integer, nullable = False)
License_status = db.Column('License_status', db.String(10), nullable = False)
Spec_Area = db.Column('Spec_Area', db.String(30), nullable = False)
FirmID = db.Column('FirmID', db.Integer,db.ForeignKey('Firms.ID'))
ED_Profile = db.Column('Ed_Profile', db.String(30), nullable = False)
Rating = db.Column('Rating', db.Integer)
Fees_Range = db.Column('Fees_Range', db.Integer)
class Firms (db.Model):
__tablename__ = 'Firms'
ID = db.Column('ID', db.Integer, primary_key = True)
Name = db.Column('Name', db.String(30), nullable = False)
License_status = db.Column('License_status', db.String(10), nullable = False)
Spec_Area = db.Column('Spec_Area', db.String(30), nullable = False)
Rating = db.Column('Rating', db.Integer)
Fees_Range = db.Column('Fees_Range', db.Integer)
Est = db.Column('Est', db.Integer)
class Judge (db.Model):
__tablename__ = 'Judges'
ID = db.Column('ID', db.Integer, primary_key = True)
Name = db.Column('Name', db.String(30), nullable = False)
Recruit_Src = db.Column('Recruit_Src', db.String(30), nullable = False)
Apptmnt_Date = db.Column('Apptmnt_Date', db.Date, nullable = False)
login_manager = LoginManager()
@login_manager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))