Course - changed date formatting to JSON and some properties
This commit is contained in:
parent
7239d27da2
commit
d9382e8fbe
1 changed files with 12 additions and 6 deletions
|
@ -6,17 +6,23 @@ from google.appengine.ext import db
|
||||||
class Course(db.Model):
|
class Course(db.Model):
|
||||||
courseName = db.StringProperty(required=True)
|
courseName = db.StringProperty(required=True)
|
||||||
campusName = db.StringProperty(required=True)
|
campusName = db.StringProperty(required=True)
|
||||||
projects = db.StringListProperty(required=True)
|
projects = db.StringListProperty(required=True,default=[])
|
||||||
startDate = db.DateProperty(required=True)
|
startDate = db.DateProperty(required=True)
|
||||||
endDate = db.DateProperty(required=False)
|
endDate = db.DateProperty(required=True)
|
||||||
taskFlag = db.BooleanProperty(required=True)
|
|
||||||
|
|
||||||
def to_JSON(self):
|
def to_JSON(self):
|
||||||
data = {'courseName' : self.courseName,
|
data = {'courseName' : self.courseName,
|
||||||
'campusName' : self.campusName,
|
'campusName' : self.campusName,
|
||||||
'projects' : self.projects,
|
'projects' : self.projects,
|
||||||
'startDate' : self.startDate,
|
'startDate' : {
|
||||||
'endDate' : self.endDate,
|
'year': self.startDate.year,
|
||||||
'taskFlag' : self.taskFlag,
|
'month': self.startDate.month,
|
||||||
|
'day': self.startDate.day,
|
||||||
|
},
|
||||||
|
'endDate' : {
|
||||||
|
'year': self.endDate.year,
|
||||||
|
'month': self.endDate.month,
|
||||||
|
'day': self.endDate.day,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return json.dumps(data)
|
return json.dumps(data)
|
||||||
|
|
Loading…
Reference in a new issue