Beispiel #1
0
    def post(self):
        args = self.post_args()
        svey = Survey()
        usr  = User.objects(id = current_user.id).first()
        svey.metadata['name'] = args['s_name']

        struct_dict = starter_template
        opt = []
        for option in args['s_tags']:
            opt.append({
                'checked': False,
                'label': option
            })

        struct_dict['fields'][0]['field_options']['options'] = opt
        svey.struct = struct_dict
        svey.created_by.append(usr)
        svey.save()

        return svey.repr, 200