Skip to content

Commit d4bfa6d

Browse files
bmispelonSaptakS
authored andcommitted
fixup! Fixed #1782 -- Added page to delete one's user account
1 parent 977c235 commit d4bfa6d

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

accounts/forms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ def save(self, commit=True):
4242

4343
class DeleteProfileForm(forms.Form):
4444
"""
45-
A form for delete the request's user and their associated data.
45+
A form for deleting the request's user and their associated data.
4646
47-
This form has no fields, it's used as a container for validation and deltion
47+
This form has no fields, it's used as a container for validation and deletion
4848
logic.
4949
"""
5050

accounts/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def test_profile_view_reversal(self):
193193
reverse("user_profile", host="www", args=[username])
194194

195195

196-
class UserDeletionTestCase(TestCase):
196+
class UserDeletionTests(TestCase):
197197
def create_user_and_form(self, bound=True, **userkwargs):
198198
userkwargs.setdefault("username", "test")
199199
userkwargs.setdefault("email", "[email protected]")

accounts/views.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,15 @@ def edit_profile(request):
4040
def delete_profile(request):
4141
if request.method == "POST":
4242
form = DeleteProfileForm(data=request.POST, user=request.user)
43-
if form.is_valid():
44-
if form.delete():
45-
logout(request)
46-
return redirect("delete_profile_success")
43+
if form.is_valid() and form.delete():
44+
logout(request)
45+
return redirect("delete_profile_success")
4746
else:
4847
form = DeleteProfileForm(user=request.user)
4948

5049
context = {
5150
"form": form,
52-
# Strings are left translated on purpose (ops prefer english :D)
51+
# Strings are left untranslated on purpose (ops prefer english :D)
5352
"OPS_EMAIL_PRESETS": urlencode(
5453
{
5554
"subject": "[djangoproject.com] Manual account deletion",

djangoproject/templates/accounts/delete_profile.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ <h2>{% translate "Could not delete account" %}</h2>
1212
That means there's probably some protected data still associated
1313
with your account.
1414
Please contact
15-
<a href="mailto:[email protected]?{{ OPS_EMAIL_PRESETS }}">the operations team</a>
15+
<a href="mailto:[email protected]?{{ OPS_EMAIL_PRESETS }}">the operations team</a>,
1616
and we'll sort it out for you.
1717
{% endblocktranslate %}</p>
1818
{% else %}
1919
<h2>{% translate "Are you sure?" %}</h2>
2020

2121
<p>{% blocktranslate trimmed with username=request.user.username %}
2222
⚠️ You are about to delete all data associated with the username
23-
<strong>{{ username}}</strong>.
23+
<strong>{{ username }}</strong>.
2424
{% endblocktranslate %}</p>
2525

2626
<p>{% blocktranslate trimmed %}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
{% extends "base.html" %}
2-
32
{% load i18n %}
43

54
{% block content %}
65
<h2>{% translate "Account deleted" %}</h2>
76
<p>
8-
{% translate "Your account and its data was successfully deleted and you've been logged out." %}
7+
{% translate "Your account and its data were successfully deleted, and you've been logged out." %}
98
</p>
109
<p>
1110
{% url "community-index" as community_index_url %}
1211
{% blocktranslate trimmed %}
1312
Thanks for spending your time with us, we hope we'll still see you
14-
around on our <a href="{{ community_index_url }}">various community spaces, online and off.
13+
around on our <a href="{{ community_index_url }}">various community spaces</a>, online and off.
1514
{% endblocktranslate %}
1615
</p>
1716
{% endblock %}

0 commit comments

Comments
 (0)