-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevent.py
More file actions
40 lines (35 loc) · 967 Bytes
/
event.py
File metadata and controls
40 lines (35 loc) · 967 Bytes
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
from datetime import datetime
import uuid
# User class
class Event:
def __init__(self, title, location, start, end, desc, id=""):
# Main initialiser
self.title = title
self.location = location
self.start = start
self.end = end
self.desc = desc
self.id = uuid.uuid4().hex if not id else id
@classmethod
def make_from_dict(cls, d):
# Initialise User object from a dictionary
return cls(
d["title"],
d["location"],
d["start"],
d["end"],
d["desc"],
d["id"],
)
def dict(self):
# Return dictionary representation of the object
return {
"id": self.id,
"title": self.title,
"location": self.location,
"start": self.start,
"end": self.end,
"desc": self.desc,
}
def get_eid(self):
return self.id