Пример #1
0
def process_field_data(_registration, flat):
    """Helper to generate field data for one registration"""
    one_res = build_registration_api_data(_registration)
    ## local migration code
    if 'datatitle' in one_res:
        del one_res['datatitle']
    one_res['data'] = all_fields(_registration, flat)
    one_res['price'] = _registration.price
    if _registration.state is not None:
        one_res['state'] = _registration.state.title
    return one_res
Пример #2
0
    def _process_PATCH(self):
        if request.json is None:
            raise BadRequest('Expected JSON payload')

        invalid_fields = request.json.viewkeys() - {'checked_in'}
        if invalid_fields:
            raise BadRequest("Invalid fields: {}".format(', '.join(invalid_fields)))

        if 'checked_in' in request.json:
            self._registration.checked_in = bool(request.json['checked_in'])

        return jsonify(build_registration_api_data(self._registration))
Пример #3
0
    def _process_PATCH(self):
        if request.json is None:
            raise BadRequest('Expected JSON payload')

        invalid_fields = request.json.viewkeys() - {'checked_in'}
        if invalid_fields:
            raise BadRequest("Invalid fields: {}".format(', '.join(invalid_fields)))

        if 'checked_in' in request.json:
            self._registration.checked_in = bool(request.json['checked_in'])

        return jsonify(build_registration_api_data(self._registration))
 def build_registration_data(self, reg):
     data = build_registration_api_data(reg)
     data['data_by_id'] = {}
     data['data_by_name'] = {}
     for field_id, item in reg.data_by_field.iteritems():
         data['data_by_id'][field_id] = item.friendly_data
     for item in reg.data:
         fieldname = slugify(item.field_data.field.title)
         fieldparent = slugify(item.field_data.field.parent.title)
         data['data_by_name']['{}_{}'.format(
             fieldparent, fieldname)] = item.friendly_data
     return data
Пример #5
0
    def _process_PATCH(self):
        if request.json is None:
            raise BadRequest('Expected JSON payload')

        invalid_fields = request.json.keys() - {'checked_in'}
        if invalid_fields:
            raise BadRequest('Invalid fields: {}'.format(', '.join(invalid_fields)))

        if 'checked_in' in request.json:
            if self._registration.state not in (RegistrationState.complete, RegistrationState.unpaid):
                raise BadRequest('This registration cannot be marked as checked-in')
            self._registration.checked_in = bool(request.json['checked_in'])
            signals.event.registration_checkin_updated.send(self._registration)

        return jsonify(build_registration_api_data(self._registration))
Пример #6
0
 def _process_GET(self):
     return jsonify(build_registration_api_data(self._registration))
Пример #7
0
 def _process_GET(self):
     return jsonify(build_registration_api_data(self._registration))