Beispiel #1
0
    def post(self, event_id):
        add_form = AddBotForm(self.request.POST)

        if add_form.validate():
            bot_data = add_form.data
            bot_data['event_id'] = int(event_id)
            bot_data['bid'] = 0
            bot_data['registered_ind'] = 'Y'
            bot = Bot(**bot_data)
            bot.put()
            response = {
                'successful': True,
                'message': json.dumps(bot.to_dict())
            }
        else:
            response = {
                'successful': False,
                'message': json.dumps(add_form.errors)
            }

        context = {
            'data': json.dumps(response)
        }

        self.render_response('json.json', **context)