Exemple #1
0
def payer_overview(slug):
    event = get_event_or_abort(slug)
    form = CreatePayerForm(request.form)
    if request.method == 'POST' and form.validate():
        payer = Payer(name=form.name.data, weight=form.weight.data, event=event)
        payer.save()
        return redirect(url_for('payer_overview', slug=event.slug))
    return render_template('payer_overview.html', **locals())
Exemple #2
0
    def get(self, event_slug, payer_id):
        event = Event.get_by_slug(event_slug)
        if not event:
            abort(404)

        if payer_id is None:
            payers = [payer.get_json_data(url_for) for payer in event.payers]
            data = {'payers': payers}
            return json_response(data)
        else:
            payer = Payer.get_by_id_and_event_id(payer_id, event.id)
            if not payer:
                abort(404)
            return json_response(payer.get_json_data(url_for))
Exemple #3
0
    def get(self, event_slug, payer_id):
        event = Event.get_by_slug(event_slug)
        if not event:
            abort(404)

        if payer_id is None:
            payers = [payer.get_json_data(url_for) for payer in event.payers]
            data = {'payers': payers}
            return json_response(data)
        else:
            payer = Payer.get_by_id_and_event_id(payer_id, event.id)
            if not payer:
                abort(404)
            return json_response(payer.get_json_data(url_for))