[damned-lies] Added ability to edit account username
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Added ability to edit account username
- Date: Fri, 1 Sep 2017 19:00:37 +0000 (UTC)
commit 4e7cc7118236b8af2423e04804d71727de0d678c
Author: Claude Paroz <claude 2xlibre net>
Date: Fri Sep 1 21:00:03 2017 +0200
Added ability to edit account username
Fixes bug #787151.
people/forms.py | 4 +++-
people/tests.py | 6 ++++--
2 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/people/forms.py b/people/forms.py
index ff6f5db..6fcebcf 100644
--- a/people/forms.py
+++ b/people/forms.py
@@ -88,10 +88,11 @@ class RegistrationForm(forms.Form):
send_mail(_('Account activation'), message, to=[email])
return new_user
+
class DetailForm(forms.ModelForm):
class Meta:
model = Person
- fields = ('first_name', 'last_name', 'email', 'image', 'avatar_service',
+ fields = ('username', 'first_name', 'last_name', 'email', 'image', 'avatar_service',
'webpage_url', 'irc_nick', 'bugzilla_account')
def clean_image(self):
@@ -104,6 +105,7 @@ class DetailForm(forms.ModelForm):
'width': size[0], 'height': size[1]})
return url
+
class TeamJoinForm(forms.Form):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
diff --git a/people/tests.py b/people/tests.py
index a1338eb..f194f31 100644
--- a/people/tests.py
+++ b/people/tests.py
@@ -59,11 +59,13 @@ class PeopleTestCase(TestCase):
response = self.client.get(reverse('person_detail_change'))
self.assertContains(response, "First name")
post_data = {
- 'first_name': "Johnny", 'last_name': "Nothing", 'email': 'test02 example org',
+ 'username': 'jn2', 'first_name': "Johnny", 'last_name': "Nothing",
+ 'email': 'test02 example org',
'image': '', 'webpage_url': "http://www.example.org/"
}
response = self.client.post(reverse('person_detail_change'), post_data)
- self.pn = Person.objects.get(pk=self.pn.pk)
+ self.pn.refresh_from_db()
+ self.assertEqual(self.pn.username, 'jn2')
self.assertEqual(self.pn.email, 'test02 example org')
# bad image url
post_data['image'] = "http://http://www.example.org/image.jpg"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]