Skip to content

TypeError: type 'SetPasswordForm' is not subscriptable #2697

Closed
@adnathanail

Description

@adnathanail

Bug report

Thanks so much for this library! It's invaluable

What's wrong

I've just updated to version 5.2.0 and am trying to set the new type parameter on SetPasswordForm but I'm getting an error at runtime

Traceback (most recent call last):
File "/home/appuser/manage.py", line 22, in <module>
  execute_from_command_line(sys.argv)
  ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
File "/venv/lib/python3.13/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
  utility.execute()
  ~~~~~~~~~~~~~~~^^
File "/venv/lib/python3.13/site-packages/django/core/management/__init__.py", line 416, in execute
  django.setup()
  ~~~~~~~~~~~~^^
File "/venv/lib/python3.13/site-packages/django/__init__.py", line 24, in setup
  apps.populate(settings.INSTALLED_APPS)
  ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.13/site-packages/django/apps/registry.py", line 124, in populate
  app_config.ready()
  ~~~~~~~~~~~~~~~~^^
File "/venv/lib/python3.13/site-packages/django/contrib/admin/apps.py", line 27, in ready
  self.module.autodiscover()
  ~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/venv/lib/python3.13/site-packages/django/contrib/admin/__init__.py", line 52, in autodiscover
  autodiscover_modules("admin", register_to=site)
  ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.13/site-packages/django/utils/module_loading.py", line 58, in autodiscover_modules
  import_module("%s.%s" % (app_config.name, module_to_search))
  ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/importlib/__init__.py", line 88, in import_module
  return _bootstrap._gcd_import(name[level:], package, level)
         ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 1026, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/home/appuser/accounts/admin.py", line 9, in <module>
  from . import forms, models
File "/home/appuser/accounts/forms.py", line 306, in <module>
  class SetPasswordForm(auth_forms.SetPasswordForm[User]):
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
TypeError: type 'SetPasswordForm' is not subscriptable

This seems to have been discussed here:
#2384 (comment)

But I tried the latest version off master and I'm still seeing the error

How is that should be

There should be no runtime error!

System information

  • OS: python:3.13-slim-bookworm Dockerfile
  • python version: 3.13
  • django version: 5.1.7
  • mypy version: 1.15
  • django-stubs version: master
  • django-stubs-ext version: master

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions