se-hub/models/Task.py

28 lines
855 B
Python
Raw Normal View History

import json
2015-06-21 19:19:24 +00:00
import time
__author__ = 'Aran'
from google.appengine.ext import db
2015-06-21 19:19:24 +00:00
class Task(db.Model):
title = db.StringProperty(required=True)
2015-06-29 10:40:11 +00:00
courseId = db.IntegerProperty(required=True)
2015-06-18 18:30:09 +00:00
description = db.StringProperty(required=True,default=" ")
dueDate = db.DateProperty(required=True)
isPersonal = db.BooleanProperty(required=True, default=True)
def to_JSON(self):
data = {'title' : self.title,
2015-06-29 10:40:11 +00:00
'courseId' : self.courseId,
'description' : self.description,
2015-06-21 19:19:24 +00:00
'dueDate' : {
'year': self.dueDate.year,
'month': self.dueDate.month,
'day': self.dueDate.day
},
'isPersonal' : self.isPersonal,
2015-06-21 22:38:01 +00:00
'id' : self.key().id()
}
return json.dumps(data)
2015-06-21 19:19:24 +00:00