From d9382e8fbedbe5271912a01aa0fa015777fb4450 Mon Sep 17 00:00:00 2001 From: aranzaiger Date: Mon, 15 Jun 2015 01:37:07 +0300 Subject: [PATCH] Course - changed date formatting to JSON and some properties --- models/Course.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/models/Course.py b/models/Course.py index 83557a7..7b2ac75 100644 --- a/models/Course.py +++ b/models/Course.py @@ -6,17 +6,23 @@ from google.appengine.ext import db class Course(db.Model): courseName = 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) - endDate = db.DateProperty(required=False) - taskFlag = db.BooleanProperty(required=True) + endDate = db.DateProperty(required=True) def to_JSON(self): data = {'courseName' : self.courseName, 'campusName' : self.campusName, 'projects' : self.projects, - 'startDate' : self.startDate, - 'endDate' : self.endDate, - 'taskFlag' : self.taskFlag, + '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, + } } return json.dumps(data)