summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2014-06-26 06:58:12 -0400
committerTim Graham <timograham@gmail.com>2014-06-30 14:20:51 -0400
commitcf252dbea66d9c4a84aa1bc8da93b5e5cc759b9a (patch)
tree15ef1bc3ebfffe7493cf57432d56ea26b22f8ae2
parent5359188b0802f39201a6ce45a08391597c8174bb (diff)
Fixed #8162 -- Increased Permission.name max_length to 255 characters.
-rw-r--r--django/contrib/auth/migrations/0002_alter_permission_name_max_length.py19
-rw-r--r--django/contrib/auth/models.py2
-rw-r--r--django/contrib/auth/tests/test_management.py4
-rw-r--r--docs/releases/1.8.txt3
4 files changed, 25 insertions, 3 deletions
diff --git a/django/contrib/auth/migrations/0002_alter_permission_name_max_length.py b/django/contrib/auth/migrations/0002_alter_permission_name_max_length.py
new file mode 100644
index 0000000000..8e82223237
--- /dev/null
+++ b/django/contrib/auth/migrations/0002_alter_permission_name_max_length.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('auth', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='permission',
+ name='name',
+ field=models.CharField(max_length=255, verbose_name='name'),
+ ),
+ ]
diff --git a/django/contrib/auth/models.py b/django/contrib/auth/models.py
index 14f0a5ecd8..9c6f7247bf 100644
--- a/django/contrib/auth/models.py
+++ b/django/contrib/auth/models.py
@@ -61,7 +61,7 @@ class Permission(models.Model):
Three basic permissions -- add, change and delete -- are automatically
created for each Django model.
"""
- name = models.CharField(_('name'), max_length=50)
+ name = models.CharField(_('name'), max_length=255)
content_type = models.ForeignKey(ContentType)
codename = models.CharField(_('codename'), max_length=100)
objects = PermissionManager()
diff --git a/django/contrib/auth/tests/test_management.py b/django/contrib/auth/tests/test_management.py
index a800b7379a..fc016135b2 100644
--- a/django/contrib/auth/tests/test_management.py
+++ b/django/contrib/auth/tests/test_management.py
@@ -503,8 +503,8 @@ class PermissionTestCase(TestCase):
permission_content_type = ContentType.objects.get_by_natural_key('auth', 'permission')
models.Permission.objects.filter(content_type=permission_content_type).delete()
- models.Permission._meta.verbose_name = "some ridiculously long verbose name that is out of control"
+ models.Permission._meta.verbose_name = "some ridiculously long verbose name that is out of control" * 5
six.assertRaisesRegex(self, exceptions.ValidationError,
- "The verbose_name of permission is longer than 39 characters",
+ "The verbose_name of permission is longer than 244 characters",
create_permissions, auth_app_config, verbosity=0)
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index 96bcc55051..7534a16e3d 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -46,6 +46,9 @@ Minor features
* :class:`~django.contrib.auth.forms.PasswordResetForm` now
has a method :meth:`~django.contrib.auth.forms.PasswordResetForm.send_email`
that can be overridden to customize the mail to be sent.
+* The ``max_length`` of :attr:`Permission.name
+ <django.contrib.auth.models.Permission.name>` has been increased from 50 to
+ 255 characters. Please run the database migration.
:mod:`django.contrib.formtools`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^