Fixed #8162 -- Increased Permission.name max_length to 255 characters.

This commit is contained in:
Tim Graham 2014-06-26 06:58:12 -04:00
parent 5359188b08
commit cf252dbea6
4 changed files with 25 additions and 3 deletions

View File

@ -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'),
),
]

View File

@ -61,7 +61,7 @@ class Permission(models.Model):
Three basic permissions -- add, change and delete -- are automatically Three basic permissions -- add, change and delete -- are automatically
created for each Django model. created for each Django model.
""" """
name = models.CharField(_('name'), max_length=50) name = models.CharField(_('name'), max_length=255)
content_type = models.ForeignKey(ContentType) content_type = models.ForeignKey(ContentType)
codename = models.CharField(_('codename'), max_length=100) codename = models.CharField(_('codename'), max_length=100)
objects = PermissionManager() objects = PermissionManager()

View File

@ -503,8 +503,8 @@ class PermissionTestCase(TestCase):
permission_content_type = ContentType.objects.get_by_natural_key('auth', 'permission') permission_content_type = ContentType.objects.get_by_natural_key('auth', 'permission')
models.Permission.objects.filter(content_type=permission_content_type).delete() 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, 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) create_permissions, auth_app_config, verbosity=0)

View File

@ -46,6 +46,9 @@ Minor features
* :class:`~django.contrib.auth.forms.PasswordResetForm` now * :class:`~django.contrib.auth.forms.PasswordResetForm` now
has a method :meth:`~django.contrib.auth.forms.PasswordResetForm.send_email` has a method :meth:`~django.contrib.auth.forms.PasswordResetForm.send_email`
that can be overridden to customize the mail to be sent. 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` :mod:`django.contrib.formtools`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^