mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-13 02:41:08 +00:00
8f57aa5f37
Redoes the UI to remove timelines, promote domains, and a lot of other things to support the refactor.
32 lines
1,007 B
Python
32 lines
1,007 B
Python
from django import forms
|
|
from django.contrib import messages
|
|
from django.shortcuts import redirect
|
|
from django.views.generic import FormView
|
|
|
|
from users.views.base import IdentityViewMixin
|
|
|
|
|
|
class DeleteIdentity(IdentityViewMixin, FormView):
|
|
|
|
template_name = "settings/delete.html"
|
|
extra_context = {"section": "delete"}
|
|
|
|
class form_class(forms.Form):
|
|
confirmation = forms.CharField(
|
|
help_text="Write the word DELETE in this box if you wish to delete this account",
|
|
required=True,
|
|
)
|
|
|
|
def clean_confirmation(self):
|
|
value = self.cleaned_data.get("confirmation")
|
|
if value.lower() != "delete":
|
|
raise forms.ValidationError("You must write DELETE here")
|
|
return value
|
|
|
|
def form_valid(self, form):
|
|
self.identity.mark_deleted()
|
|
messages.success(
|
|
self.request,
|
|
f"The identity {self.identity.handle} is now being deleted.",
|
|
)
|
|
return redirect("/")
|