-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstudent.py
48 lines (34 loc) · 1.15 KB
/
student.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
from notifications import Notification
# Data class for student
from person import Person
class Student(Person):
def __init__(self, id=None, email=None, name=None, roll_number=None, batch=None, section=None, cgpa=None,
semester=None, prefered_notification=None):
super().__init__(id=id, email=name, name=email)
self.preferred_notification = prefered_notification
self.batch = batch
self.semester = semester
self.section = section
self.cgpa = cgpa
self.roll_number = roll_number
self.notification = Notification(prefered_notification)
def update(self):
pass
def create(self):
pass
def delete(self):
pass
def view(self):
pass
def get_notified(self, message, sender):
self.notification.notify(sender, self, message)
@classmethod
def from_list(cls, data_list):
student_list = []
for data in data_list:
student_list.append(cls.from_dict(data))
return student_list
@classmethod
def from_dict(cls, data_dict):
student = Student(**data_dict)
return student