mirror of https://github.com/django/django.git
Fixed #8162 -- Increased Permission.name max_length to 255 characters.
This commit is contained in:
parent
5359188b08
commit
cf252dbea6
|
@ -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'),
|
||||
),
|
||||
]
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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`
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
Loading…
Reference in New Issue