* component: Migrations => contrib.auth
* stage: Unreviewed => Accepted
Comment:
Thanks for this report, it's related with adding missing permissions. I
was able to fix this by setting `_state.db`, however I'm not convinced
that it's the best solution:
{{{#!diff
diff --git a/django/contrib/auth/management/__init__.py
b/django/contrib/auth/management/__init__.py
index 0b5a982617..27fe0df1d7 100644
--- a/django/contrib/auth/management/__init__.py
+++ b/django/contrib/auth/management/__init__.py
@@ -94,12 +94,15 @@ def create_permissions(
)
.values_list("content_type", "codename")
)
-
- perms = [
- Permission(codename=codename, name=name, content_type=ct)
- for ct, (codename, name) in searched_perms
- if (ct.pk, codename) not in all_perms
- ]
+ perms = []
+ for ct, (codename, name) in searched_perms:
+ if (ct.pk, codename) not in all_perms:
+ permission = Permission()
+ permission._state.db = using
+ permission.codename = codename
+ permission.name = name
+ permission.content_type = ct
+ perms.append(permission)
Permission.objects.using(using).bulk_create(perms)
if verbosity >= 2:
for perm in perms:
}}}
Partly related to #29843.
--
Ticket URL: <https://code.djangoproject.com/ticket/34165#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.