se-hub/models/Message.py

29 lines
921 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):
groupId = db.IntegerProperty(required=True)
2015-06-21 19:18:48 +00:00
message = db.StringProperty(required=True)
msgDate = db.DateTimeProperty(required=True)
master_id = db.IntegerProperty(required=True)
isProject = db.BooleanProperty(default=False)
2015-06-21 19:18:48 +00:00
def to_JSON(self):
data = {
'groupId' : self.groupId,
2015-06-21 19:18:48 +00:00
'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(),
'master_id' : self.master_id,
'isProject' : self.isProject
2015-06-21 19:18:48 +00:00
}
return json.dumps(data)