diff --git a/django/contrib/auth/management/__init__.py b/django/contrib/auth/management/__init__.py
index 46dbea8..5f625aa 100644
a
|
b
|
def create_permissions(app, created_models, verbosity, **kwargs):
|
35 | 35 | # Find all the Permissions that have a context_type for a model we're |
36 | 36 | # looking for. We don't need to check for codenames since we already have |
37 | 37 | # a list of the ones we're going to create. |
38 | | all_perms = set(auth_app.Permission.objects.filter( |
39 | | content_type__in=ctypes, |
40 | | ).values_list( |
41 | | "content_type", "codename" |
42 | | )) |
| 38 | all_perms = set() |
| 39 | ctypes_pks = set(ct.pk for ct in ctypes) |
| 40 | for ctype, codename in auth_app.Permission.objects.all().values_list( |
| 41 | 'content_type', 'codename')[:1000000]: |
| 42 | if ctype in ctypes_pks: |
| 43 | all_perms.add((ctype, codename)) |
43 | 44 | |
44 | 45 | for ctype, (codename, name) in searched_perms: |
45 | 46 | # If the permissions exists, move on. |