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)
|
2015-06-11 19:46:18 +00:00
|
|
|
name = db.StringProperty(required=False)
|
2015-05-11 18:45:46 +00:00
|
|
|
email = db.StringProperty(required=True)
|
|
|
|
isLecturer = db.BooleanProperty(required=True)
|
2015-06-10 18:39:42 +00:00
|
|
|
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-11 18:01:05 +00:00
|
|
|
campuses_id_list = db.StringListProperty(default=[])
|
2015-06-23 21:54:55 +00:00
|
|
|
courses_id_list = db.StringListProperty(default=[])
|
2015-06-24 17:01:55 +00:00
|
|
|
projects_id_list = db.StringListProperty(default=[])
|
2015-05-11 18:45:46 +00:00
|
|
|
|
|
|
|
def to_JSON(self):
|
2015-06-10 18:39:42 +00:00
|
|
|
data = {'username' : self.username,
|
2015-05-11 18:45:46 +00:00
|
|
|
'name' : self.name,
|
|
|
|
'email' : self.email,
|
|
|
|
'isLecturer' : self.isLecturer,
|
|
|
|
'avatar_url' : self.avatar_url,
|
|
|
|
'isFirstLogin' : self.isFirstLogin,
|
2015-06-10 14:41:49 +00:00
|
|
|
'campuses_id_list': self.campuses_id_list,
|
2015-06-24 17:01:55 +00:00
|
|
|
'courses_id_list': self.courses_id_list,
|
2015-06-24 21:04:04 +00:00
|
|
|
'projects_id_list': self.projects_id_list,
|
|
|
|
'id' : self.key().id()
|
2015-05-11 18:45:46 +00:00
|
|
|
}
|
2015-06-10 18:44:12 +00:00
|
|
|
return json.dumps(data)
|