-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
36 lines (27 loc) · 1.28 KB
/
models.py
File metadata and controls
36 lines (27 loc) · 1.28 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
30
31
32
33
34
35
36
from google.appengine.ext import db
class User(db.Model):
# list of typical fields, but be careful of special fields (like user_id)
PROP_LIST = ["email", "first_name", "middle_name", "last_name", "nickname", "gender",
"occupation", "affiliation", "field", "location", "hackathons"]
user_id = db.StringProperty(required=True)
created = db.DateTimeProperty(auto_now_add=True)
last_updated = db.DateTimeProperty(auto_now=True)
email = db.StringProperty(required=True)
first_name = db.StringProperty(required=True)
middle_name = db.StringProperty()
last_name = db.StringProperty(required=True)
nickname = db.StringProperty()
gender = db.StringProperty()
occupation = db.StringProperty()
affiliation = db.StringProperty()
field = db.StringProperty()
location = db.StringProperty()
hackathons = db.StringProperty()
# NOTE: for when/is we want to use our own profile picture system
# profile_pic_blobkey = db.StringProperty()
def populate_entity(form, entity, entity_class):
for prop in entity_class.PROP_LIST:
setattr(entity, prop, getattr(form, prop).data)
def populate_form(form, entity, entity_class):
for prop in entity_class.PROP_LIST:
getattr(form, prop).data = getattr(entity, prop)