def get(self, key): #GET THE MESSAGE CLICKED ON BY THE USER message = Messages.get_by_id(int(key)) #GET THE AUTHOR OF THAT MESSAGE author = message.user.get() display_values = {'author': author} # DISPLAY THE FORM TO SEND OTHER USERS AN EMAIL self.render('email/send_email.html', **display_values)
def get(self, message_id): #DISPLAY THE MESSAGE PAGE WITH THE MESSAGE SELECTED BY THE USER message = Messages.get_by_id(int(message_id)) author = message.user.get() replies = Replies.ret_all_replies_by_message(int(message_id)) message_display_values = { 'message': message, 'author': author, 'message_id': message_id, 'replies': replies } self.render('message-page/message-page.html', **message_display_values)
def post(self): #HANDLE THE REQUEST TO SUBMIT A REPLY TO A MESSAGE user_key = self.logged_in_user_status.key message_id = self.request.get('message_id') content = self.request.get('content') if message_id and content: #GET MESSAGE FROM MESSAGE ID message = Messages.get_by_id(int(message_id)) #ADD THE REPLY TO THE DATASTORE TABLE Replies.new_reply( user_key=user_key, message_key=message.key, content=content ) #RETURN BACK TO THE ORIGINAL MESSAGE PAGE self.redirect('/message/'+ message_id)