2015-06-21 19:18:48 +00:00
|
|
|
import json
|
|
|
|
|
|
|
|
__author__ = 'Aran'
|
|
|
|
from google.appengine.ext import db
|
|
|
|
|
|
|
|
class Message(db.Model):
|
|
|
|
courseName = db.StringProperty(required=True)
|
|
|
|
message = db.StringProperty(required=True)
|
|
|
|
msgDate = db.DateTimeProperty(required=True)
|
|
|
|
|
|
|
|
def to_JSON(self):
|
|
|
|
data = {
|
|
|
|
'courseName' : self.courseName,
|
|
|
|
'message' : self.message,
|
|
|
|
'date' : {
|
|
|
|
'year': self.msgDate.year,
|
|
|
|
'month': self.msgDate.month,
|
|
|
|
'day': self.msgDate.day,
|
|
|
|
'hour': self.msgDate.hour,
|
|
|
|
'minute': self.msgDate.minute
|
2015-06-21 22:38:01 +00:00
|
|
|
},
|
|
|
|
'id' : self.key().id()
|
2015-06-21 19:18:48 +00:00
|
|
|
}
|
|
|
|
return json.dumps(data)
|