se-hub/models/Course.py

34 lines
1.1 KiB
Python
Raw Normal View History

import json
__author__ = 'Aran'
from google.appengine.ext import db
class Course(db.Model):
courseName = db.StringProperty(required=True)
campusId = db.IntegerProperty(required=True)
2015-06-15 13:32:35 +00:00
master_id = db.IntegerProperty(required=True)
# projects = db.StringListProperty(required=True,default=[])
startDate = db.DateProperty(required=True)
endDate = db.DateProperty(required=True)
2015-06-24 17:23:50 +00:00
membersId = db.StringListProperty(required=True)
def to_JSON(self):
data = {'courseName' : self.courseName,
2015-06-28 14:30:22 +00:00
'campusId' : self.campusId,
2015-06-15 13:32:35 +00:00
'master_id' : self.master_id,
# 'projects' : self.projects,
'startDate' : {
'year': self.startDate.year,
'month': self.startDate.month,
'day': self.startDate.day,
},
'endDate' : {
'year': self.endDate.year,
'month': self.endDate.month,
'day': self.endDate.day,
2015-06-21 22:38:01 +00:00
},
2015-06-24 17:23:50 +00:00
'membersId' : self.membersId,
2015-06-21 22:38:01 +00:00
'id' : self.key().id()
}
return json.dumps(data)