se-hub/models/User.py

31 lines
1.1 KiB
Python
Raw Normal View History

2015-05-11 18:45:46 +00:00
import json
__author__ = 'Aran'
from google.appengine.ext import db
class User(db.Model):
username = db.StringProperty(required=True)
name = db.StringProperty(required=False)
2015-05-11 18:45:46 +00:00
email = db.StringProperty(required=True)
isLecturer = db.BooleanProperty(required=True)
accessToken = db.StringProperty(required=True)
2015-05-11 18:45:46 +00:00
seToken = db.StringProperty(required=True)
avatar_url = db.StringProperty(required=True)
isFirstLogin = db.BooleanProperty(default=True)
2015-06-16 19:42:15 +00:00
campusName = db.StringProperty(required=True, default="")
campuses_id_list = db.StringListProperty(default=[])
classes_id_list = db.StringListProperty(default=[])
2015-05-11 18:45:46 +00:00
def to_JSON(self):
data = {'username' : self.username,
2015-05-11 18:45:46 +00:00
'name' : self.name,
'email' : self.email,
'isLecturer' : self.isLecturer,
'seToken' : self.seToken,
'avatar_url' : self.avatar_url,
'isFirstLogin' : self.isFirstLogin,
'campuses_id_list': self.campuses_id_list,
'classes_id_list': self.classes_id_list
2015-05-11 18:45:46 +00:00
}
return json.dumps(data)