-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
29 lines (26 loc) · 1.07 KB
/
Copy pathmodels.py
File metadata and controls
29 lines (26 loc) · 1.07 KB
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
from datetime import datetime
from ext import db
class Student(db.Model):
__tablename__ = 'Student' # or 'Student', just keep it consistent
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(200), nullable=False)
course = db.Column(db.String(100), nullable=True)
hobbies = db.Column(db.Text, nullable=True)
languages = db.Column(db.String(200), nullable=True)
motto = db.Column(db.Text, nullable=True)
career_interests = db.Column(db.String(200), nullable=True)
reason = db.Column(db.Text, nullable=True)
picture = db.Column(db.String(200), nullable=True)
created_at = db.Column(db.DateTime, default=datetime.utcnow)
def to_dict(self):
return {
'id': self.id,
'name': self.name,
'course': self.course,
'hobbies': self.hobbies,
'languages': self.languages,
'motto': self.motto,
'career_interests': self.career_interests,
'reason': self.reason,
'picture': self.picture,
}