se-hub/models/User.py

32 lines
1.2 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)
campuses_id_list = db.StringListProperty(default=[])
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):
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,
'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
}
return json.dumps(data)