-
Notifications
You must be signed in to change notification settings - Fork 0
/
note.py
29 lines (25 loc) · 857 Bytes
/
note.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
from datetime import datetime
import uuid
# Note class
class Note():
def __init__(self, title, body, user_id, user_name, id="", deleted=False):
self.title = title
self.body = body
self.user_id = user_id
self.user_name = user_name
self.timestamp = datetime.utcnow()
self.date_string = self.timestamp.strftime("%d/%m/%Y, %H:%M:%S")
self.id = uuid.uuid4().hex if not id else id
self.deleted = deleted
# Return dictionary representation of object
def dict(self):
return {
"title": self.title,
"body": self.body,
"user_id": self.user_id,
"user_name": self.user_name,
"timestamp": self.timestamp,
"date_string": self.date_string,
"id": self.id,
"deleted": self.deleted
}