def create_match_bout( match_id ): match = find_match( match_id ) bout_data = request.data del bout_data['current_round'] bout_data = reassign_bout( bout_data ) match.individual_bouts.append( bout_data ) match.save() return json.dumps( match, default=remove_OIDs)
def update_school_match(match_id): json_data = request.data match = Match( **json_data ) match._id = ObjectId( match_id ) match.schools = [ prepare_school(school) for school in match.schools ] match.individual_bouts = [ reassign_bout(bout) for bout in match.individual_bouts ] match.match_date = datetime.strptime(match.match_date, '%m/%d/%Y') match.save() return json.dumps( match, default=remove_OIDs)