Beispiel #1
0
def request_refund(request, id):
    registration = Registration.objects.get(id=id)
    if request.method == 'GET':
        form = RefundRequestForm(user=request.user, registration=registration)
    elif request.method == 'POST':
        form = RefundRequestForm(request.POST,
                                 user=request.user,
                                 registration=registration)
        if form.is_valid():
            refund = form.save()
            # @todo: Email admins here?
            Log.create(
                text='Refund request for %s created %s by %s' %
                (registration.email, refund.requested, request.user.username),
                objects=[registration, registration.event, request.user])
            return redirect('registration',
                            id=registration.id)  #event.get_absolute_url()
    return render(request, 'ezreg/request_refund.html', {
        'form': form,
        'registration': registration
    })
Beispiel #2
0
def update_registration_status(request, id):
    registration = Registration.objects.get(id=id)
    if request.method == 'GET':
        form = AdminRegistrationStatusForm(instance=registration)
    elif request.method == 'POST':
        form = AdminRegistrationStatusForm(request.POST, instance=registration)
        if form.is_valid():
            registration = form.save()
            email_status(registration)
            Log.create(
                text='Registration status for %s updated to %s by %s' %
                (registration.email, registration.status,
                 request.user.username),
                objects=[registration, registration.event, request.user])
            return redirect(
                'registrations',
                slug_or_id=registration.event_id)  #event.get_absolute_url()
    return render(request, 'ezreg/update_registration_status.html', {
        'form': form,
        'registration': registration
    })