se-hub/models/Message.py

24 lines
697 B
Python
Raw Normal View History

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
}
}
return json.dumps(data)