def post(self): self.response.headers['Content-Type'] = 'text/html' # pull the current user from the Request user = users.get_current_user() id = user.user_id() print(id) new_tbd_id = '' action = self.request.get('button') print("hey") print(id) name = self.request.get('tbd_name') if user and action == 'Submit': myuser_key = ndb.Key('MyUser', id) myuser = myuser_key.get() new_taskboard = TaskBoard() new_taskboard.tbd_name = self.request.get('tbd_name') #new_taskboard.tbd_creator = myuser_key new_taskboard.tbd_creator_email = user.email() new_taskboard.put() new_tbd_id = ndb.Key('TaskBoard', new_taskboard.key.id()) myuser.tb_key.append(new_tbd_id) myuser.put() self.redirect('/view_taskboard') elif user and action == 'Cancel': self.redirect('/view_taskboard') else: self.redirect('/view_taskboard')
def post(self): self.response.headers['Content-Type'] = 'text/html' user = users.get_current_user() myuser_key = ndb.Key('MyUser', user.email()) myuser = myuser_key.get() action = self.request.get('button') if action == 'Create': new_board_name = self.request.get('tb_name') id = str(random.randint(0, 1000000)) newBoard = TaskBoardProperty(tb_name=new_board_name, tb_id=id) myuser.myuser_board.append(newBoard) myuser.put() new_entry = TaskBoard(id=id, tb_name=new_board_name, creator=myuser.email) new_entry.tb_member.append(myuser.email) new_entry.put() self.redirect('/new_tb')
def post(self): self.response.headers['Content-Type'] = 'text/html' template_values = {} user = users.get_current_user() if self.request.get('button') == 'Create': if user: usr = ndb.Key("User", user.user_id()).get() task_board = TaskBoard() if len(self.request.get('taskboard_name').strip()) > 0: task_board.name = self.request.get('taskboard_name') task_board.creator = usr.key task_board.put() usr.taskBoards.append(task_board.key) usr.put() self.redirect('/') else: self.redirect('/') else: self.redirect('/') if self.request.get('button') == 'Back': self.redirect('/')