-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
21 lines (18 loc) · 832 Bytes
/
models.py
File metadata and controls
21 lines (18 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from google.appengine.ext import ndb
class ModelWithUser(ndb.Model):
nickname = ndb.StringProperty()
user_id = ndb.StringProperty()
joined_on = ndb.DateTimeProperty(auto_now_add=True) #changes when it is first created
updated_on = ndb.DateTimeProperty(auto_now=True) #changes whenever its active
first_name = ndb.StringProperty()
last_name = ndb.StringProperty()
profile_pic =ndb.StringProperty(default="https://cdn.pixabay.com/photo/2018/10/30/16/06/water-lily-3784022__340.jpg")
@classmethod
def get_by_user(cls, user):
return cls.query().filter(cls.user_id == user.user_id()).get()
class Event(ndb.Model):
start = ndb.DateTimeProperty()
end = ndb.DateTimeProperty()
type = ndb.StringProperty()
owner = ndb.StringProperty()
google_calendar = ndb.StringProperty()