summaryrefslogtreecommitdiff
path: root/docs/topics
diff options
context:
space:
mode:
authorArtyom Kotovskiy <mrartem1927@gmail.com>2025-04-20 18:17:47 -0400
committerJacob Walls <jacobtylerwalls@gmail.com>2026-02-27 07:45:21 -0500
commita040f555069971192220122555f187530d679d53 (patch)
treeab59214658c5ccb71de7df63dd6da0237b705a00 /docs/topics
parent187a789f99ecbc708de517c6b54d480b68ba59fe (diff)
Fixed #27489 -- Renamed permissions upon model renaming in migrations.
Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
Diffstat (limited to 'docs/topics')
-rw-r--r--docs/topics/auth/default.txt12
1 files changed, 12 insertions, 0 deletions
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: