Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #19945 -- Fixed default User model Meta inheritance.

Updated default User model Meta class to extend AbstractUser Meta
where translated verbose_name and verbose_name_plural are
defined.
  • Loading branch information...
commit f39fead1c37f1b6ed8772e252f96adee44447a3d 1 parent 0c82b1d
Matias Bordese authored March 01, 2013
2  django/contrib/auth/models.py
@@ -461,7 +461,7 @@ class User(AbstractUser):
461 461
 
462 462
     Username, password and email are required. Other fields are optional.
463 463
     """
464  
-    class Meta:
  464
+    class Meta(AbstractUser.Meta):
465 465
         swappable = 'AUTH_USER_MODEL'
466 466
 
467 467
 
11  django/contrib/auth/tests/basic.py
@@ -12,6 +12,7 @@
12 12
 from django.core.management import call_command
13 13
 from django.test import TestCase
14 14
 from django.test.utils import override_settings
  15
+from django.utils import translation
15 16
 from django.utils.encoding import force_str
16 17
 from django.utils.six import binary_type, PY3, StringIO
17 18
 
@@ -232,3 +233,13 @@ def test_swappable_user_nonexistent_model(self):
232 233
         "The current user model must point to an installed model"
233 234
         with self.assertRaises(ImproperlyConfigured):
234 235
             get_user_model()
  236
+
  237
+    @skipIfCustomUser
  238
+    def test_user_verbose_names_translatable(self):
  239
+        "Default User model verbose names are translatable (#19945)"
  240
+        with translation.override('en'):
  241
+            self.assertEqual(User._meta.verbose_name, 'user')
  242
+            self.assertEqual(User._meta.verbose_name_plural, 'users')
  243
+        with translation.override('es'):
  244
+            self.assertEqual(User._meta.verbose_name, 'usuario')
  245
+            self.assertEqual(User._meta.verbose_name_plural, 'usuarios')

0 notes on commit f39fead

Please sign in to comment.
Something went wrong with that request. Please try again.