diff --git a/django/contrib/comments/forms.py b/django/contrib/comments/forms.py
index 4ecc4c4..097b3f4 100644
|
a
|
b
|
class CommentDetailsForm(CommentSecurityForm):
|
| 106 | 106 | """ |
| 107 | 107 | Handles the specific details of the comment (name, comment, etc.). |
| 108 | 108 | """ |
| 109 | | name = forms.CharField(label=_("Name"), max_length=50) |
| | 109 | name = forms.CharField(label=_("Name"), max_length=61) |
| 110 | 110 | email = forms.EmailField(label=_("Email address")) |
| 111 | 111 | url = forms.URLField(label=_("URL"), required=False) |
| 112 | 112 | comment = forms.CharField(label=_('Comment'), widget=forms.Textarea, |
diff --git a/django/contrib/comments/models.py b/django/contrib/comments/models.py
index 5e128d2..d1e2ac8 100644
|
a
|
b
|
class Comment(BaseCommentAbstractModel):
|
| 49 | 49 | # was posted by a non-authenticated user. |
| 50 | 50 | user = models.ForeignKey(User, verbose_name=_('user'), |
| 51 | 51 | blank=True, null=True, related_name="%(class)s_comments") |
| 52 | | user_name = models.CharField(_("user's name"), max_length=50, blank=True) |
| | 52 | user_name = models.CharField(_("user's name"), max_length=61, blank=True) |
| 53 | 53 | user_email = models.EmailField(_("user's email address"), blank=True) |
| 54 | 54 | user_url = models.URLField(_("user's URL"), blank=True) |
| 55 | 55 | |
diff --git a/tests/regressiontests/comment_tests/tests/comment_view_tests.py b/tests/regressiontests/comment_tests/tests/comment_view_tests.py
index b8a62b4..106f249 100644
|
a
|
b
|
class CommentViewTests(CommentTestCase):
|
| 135 | 135 | c = Comment.objects.get(user=user) |
| 136 | 136 | self.assertEqual(c.ip_address, "1.2.3.4") |
| 137 | 137 | self.assertEqual(c.user_name, 'jane_other') |
| 138 | | user.delete() |
| 139 | 138 | |
| | 139 | def testPostAsAuthenticatedUserWithLongFullname(self): |
| | 140 | """ |
| | 141 | Check that the user's name in the comment is populated for |
| | 142 | authenticated users with a long first_name and last_name (up to 30 |
| | 143 | characters each). |
| | 144 | Refs #14175. |
| | 145 | """ |
| | 146 | user = User.objects.create_user(username='jane_other', |
| | 147 | email='jane@example.com', password='jane_other') |
| | 148 | user.first_name = 'Loooong First Name of 30 Chars' |
| | 149 | user.last_name = 'Looooong Last Name of 30 Chars' |
| | 150 | user.save() |
| | 151 | a = Article.objects.get(pk=1) |
| | 152 | data = self.getValidData(a) |
| | 153 | data['name'] = data['email'] = '' |
| | 154 | self.client.login(username="jane_other", password="jane_other") |
| | 155 | self.response = self.client.post("/post/", data, REMOTE_ADDR="1.2.3.4") |
| | 156 | c = Comment.objects.get(user=user) |
| | 157 | self.assertEqual(c.ip_address, "1.2.3.4") |
| | 158 | self.assertEqual(c.user_name, 'Loooong First Name of 30 Chars Looooong Last Name of 30 Chars') |
| | 159 | |
| 140 | 160 | def testPreventDuplicateComments(self): |
| 141 | 161 | """Prevent posting the exact same comment twice""" |
| 142 | 162 | a = Article.objects.get(pk=1) |