24 lines
697 B
Python
24 lines
697 B
Python
|
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)
|