Exemple #1
0
def toggle_billing_flag(request, username):
    user = get_object_or_404(User, username=username)

    page_message = user.get_full_name() + " billing profile: "
    if user.profile.valid_billing:
        page_message += " Invalid"
        user.profile.valid_billing = False
        email.send_invalid_billing(user)
    else:
        page_message += " Valid"
        user.profile.valid_billing = True
    user.profile.save()

    if 'back' in request.POST:
        return HttpResponseRedirect(request.POST.get('back'))
    return HttpResponseRedirect(reverse('staff:billing:bills'))
Exemple #2
0
def toggle_billing_flag(request, username):
    user = get_object_or_404(User, username=username)

    page_message = user.get_full_name() + " billing profile: "
    if user.profile.valid_billing:
        page_message += " Invalid"
        user.profile.valid_billing = False
        email.send_invalid_billing(user)
    else:
        page_message += " Valid"
        user.profile.valid_billing = True
    user.profile.save()

    if 'back' in request.POST:
        return HttpResponseRedirect(request.POST.get('back'))
    return HttpResponseRedirect(reverse('staff_bills'))
Exemple #3
0
def action_billing_flag(request, username):
    ''' Turn on/off the valid_billing flag of this user '''
    user = get_object_or_404(User, username=username)
    if user.profile.valid_billing:
        user.profile.valid_billing = False
        user.profile.save()
        messages.success(request, user.get_full_name() + " billing profile: Invalid")
        try:
            email.send_invalid_billing(user)
        except Exception:
            messages.error(request, "Failed to send invalid billing email to: " + user.email)
    else:
        user.profile.valid_billing = True
        user.profile.save()
        messages.success(request, user.get_full_name() + " billing profile: Valid")
    if 'next' in request.POST:
        return HttpResponseRedirect(request.POST.get('next'))
    return HttpResponseRedirect(reverse('staff:billing:outstanding'))