From 4225c1b1ab6c4b366e6870635140e8af044847ea Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Thu, 1 Oct 2020 17:07:17 +0100 Subject: [PATCH 1/3] Bump mypy and django-stubs versions --- {{cookiecutter.project_slug}}/requirements/local.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/{{cookiecutter.project_slug}}/requirements/local.txt b/{{cookiecutter.project_slug}}/requirements/local.txt index 5a38a438..0fea0b2d 100644 --- a/{{cookiecutter.project_slug}}/requirements/local.txt +++ b/{{cookiecutter.project_slug}}/requirements/local.txt @@ -13,8 +13,8 @@ watchgod==0.6 # https://github.com/samuelcolvin/watchgod # Testing # ------------------------------------------------------------------------------ -mypy==0.770 # https://github.com/python/mypy -django-stubs==1.5.0 # https://github.com/typeddjango/django-stubs +mypy==0.782 # https://github.com/python/mypy +django-stubs==1.6.0 # https://github.com/typeddjango/django-stubs pytest==6.1.0 # https://github.com/pytest-dev/pytest pytest-sugar==0.9.4 # https://github.com/Frozenball/pytest-sugar From 689c768abf890e54622c67566b31ab6650fb24d7 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Thu, 1 Oct 2020 19:16:22 +0100 Subject: [PATCH 2/3] Fix mypy error users/tests/test_views.py:67: error: unused 'type: ignore' comment --- .../{{cookiecutter.project_slug}}/users/tests/test_views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_views.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_views.py index 18b8da7a..3638c8f6 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_views.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_views.py @@ -64,7 +64,7 @@ class TestUserDetailView: def test_not_authenticated(self, user: User, rf: RequestFactory): request = rf.get("/fake-url/") - request.user = AnonymousUser() # type: ignore + request.user = AnonymousUser() response = user_detail_view(request, username=user.username) From 26f2a3d7bab30b221780b941cbe0ca97d7ad1207 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Thu, 1 Oct 2020 20:01:26 +0100 Subject: [PATCH 3/3] Fix mypy error my_awesome_project/users/admin.py:15: error: No overload variant of "__add__" of "tuple" matches argument type "List[Tuple[Optional[str], _FieldOpts]]" my_awesome_project/users/admin.py:15: note: Possible overload variants: my_awesome_project/users/admin.py:15: note: def __add__(self, Tuple[Tuple[str, Dict[str, Tuple[str]]], ...]) -> Tuple[Tuple[str, Dict[str, Tuple[str]]], ...] my_awesome_project/users/admin.py:15: note: def __add__(self, Tuple[Any, ...]) -> Tuple[Any, ...] my_awesome_project/users/admin.py:15: note: Right operand is of type "Union[Tuple[Tuple[Optional[str], _FieldOpts], ...], List[Tuple[Optional[str], _FieldOpts]]]" --- .../{{cookiecutter.project_slug}}/users/admin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py index cc6efed5..a68a94a9 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py @@ -12,6 +12,8 @@ class UserAdmin(auth_admin.UserAdmin): form = UserChangeForm add_form = UserCreationForm - fieldsets = (("User", {"fields": ("name",)}),) + auth_admin.UserAdmin.fieldsets + fieldsets = (("User", {"fields": ("name",)}),) + tuple( + auth_admin.UserAdmin.fieldsets + ) list_display = ["username", "name", "is_superuser"] search_fields = ["name"]