Skip to content

error: DateTimeField is nullable but its generic get type parameter is not optional #2724

@vinko-rx

Description

@vinko-rx

Bug report

What's wrong

After upgrading to 5.2.1, I am getting the following issue for any field that has null=True argument.

error: DateTimeField is nullable but its generic get type parameter is not optional  [misc]
...
error: ForeignKey is nullable but its generic get type parameter is not optional  [misc]
...
error: CharField is nullable but its generic get type parameter is not optional  [misc]

As a temporary measure, I downgraded to 5.2.0 and mypy to 1.15.0.

How is that should be

System information

  • OS: MacOS Sequoia 15.5; Ubuntu 24.04.2 (GitHub Actions)
  • python version: 3.13.4
  • django version: 5.2.3
  • mypy version: 1.16.1
  • django-stubs version: 5.2.1
  • django-stubs-ext version: 5.2.1

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