def delete_account(request): if request.method == "POST": form = DeleteAccountForm(request.POST, user=request.user) if form.is_valid(): logging.user(request.user, "~SK~BC~FRDeleting ~SB%s~SN's account." % request.user.username) request.user.profile.delete_user(confirm=True) logout_user(request) return HttpResponseRedirect(reverse("index")) else: logging.user(request.user, "~BC~FRFailed attempt to delete ~SB%s~SN's account." % request.user.username) else: logging.user(request.user, "~BC~FRAttempting to delete ~SB%s~SN's account." % request.user.username) form = DeleteAccountForm(user=request.user) return {"delete_form": form}
def delete_account(request): if request.method == 'POST': form = DeleteAccountForm(request.POST, user=request.user) if form.is_valid(): logging.user(request.user, "~SK~BC~FRDeleting ~SB%s~SN's account." % request.user.username) request.user.profile.delete_user(confirm=True) logout_user(request) return HttpResponseRedirect(reverse('index')) else: logging.user(request.user, "~BC~FRFailed attempt to delete ~SB%s~SN's account." % request.user.username) else: logging.user(request.user, "~BC~FRAttempting to delete ~SB%s~SN's account." % request.user.username) form = DeleteAccountForm(user=request.user) return { 'delete_form': form, }