diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/releases/6.1.txt | 3 | ||||
| -rw-r--r-- | docs/topics/auth/default.txt | 12 |
2 files changed, 15 insertions, 0 deletions
diff --git a/docs/releases/6.1.txt b/docs/releases/6.1.txt index ef6ae1d424..d10225dfdf 100644 --- a/docs/releases/6.1.txt +++ b/docs/releases/6.1.txt @@ -123,6 +123,9 @@ Minor features * The default iteration count for the PBKDF2 password hasher is increased from 1,200,000 to 1,500,000. +* :attr:`.Permission.name` and :attr:`.Permission.codename` values are now + renamed when renaming models via a migration. + :mod:`django.contrib.contenttypes` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/topics/auth/default.txt b/docs/topics/auth/default.txt index f9d216e1df..77888febb3 100644 --- a/docs/topics/auth/default.txt +++ b/docs/topics/auth/default.txt @@ -219,6 +219,18 @@ permissions for new models each time you run :djadmin:`manage.py migrate <migrate>` (the function that creates permissions is connected to the :data:`~django.db.models.signals.post_migrate` signal). +When a model is renamed in an installed application, Django automatically +updates the associated default permissions to match the new model name when +you run :djadmin:`manage.py migrate <migrate>`. + +If a permission with the new codename already exists +(for example, due to a leftover permission from a previous migration), +Django raises an error with next steps. + +.. versionchanged:: 6.1 + + Updating permissions when models are renamed was added. + Assuming you have an application with an :attr:`~django.db.models.Options.app_label` ``foo`` and a model named ``Bar``, to test for basic permissions you should use: |
