Merge pull request #3684 from FinnStutzenstein/fixMypy
Fixed mypy for utils/migration.py
This commit is contained in:
commit
ba579637bd
@ -1,8 +1,15 @@
|
|||||||
|
from typing import Any, Callable # noqa
|
||||||
|
|
||||||
from django.contrib.auth.models import Permission
|
from django.contrib.auth.models import Permission
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
|
|
||||||
|
|
||||||
def add_permission_to_groups_based_on_existing_permission(codename, model, app_label, new_codename, new_name):
|
def add_permission_to_groups_based_on_existing_permission(
|
||||||
|
codename: str,
|
||||||
|
model: str,
|
||||||
|
app_label: str,
|
||||||
|
new_codename: str,
|
||||||
|
new_name: str) -> Callable[[Any, Any], None]:
|
||||||
"""
|
"""
|
||||||
Creates the new permission given by new_codename and new_name to all groups,
|
Creates the new permission given by new_codename and new_name to all groups,
|
||||||
that have the base permission. This base permission is given by codename, model
|
that have the base permission. This base permission is given by codename, model
|
||||||
@ -11,7 +18,7 @@ def add_permission_to_groups_based_on_existing_permission(codename, model, app_l
|
|||||||
exist, so this does not run for a fresh database.
|
exist, so this does not run for a fresh database.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def function(apps, schema_editor):
|
def function(apps: Any, schema_editor: Any) -> None:
|
||||||
content_type = ContentType.objects.filter(model=model, app_label=app_label)
|
content_type = ContentType.objects.filter(model=model, app_label=app_label)
|
||||||
base_perm = Permission.objects.filter(codename=codename, content_type=content_type)
|
base_perm = Permission.objects.filter(codename=codename, content_type=content_type)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user