Skip to content

django.db.models.fields.json.JSONField.value_to_string returns the underlying data not str #2729

@asottile-sentry

Description

@asottile-sentry

Bug report

What's wrong

the annotation inherited from Field has value_to_string(Model) -> str -- however JSONField overrides this to return the json data directly (for django serializers)

I suspect others also override this method but I couldn't find any from a quick search

How is that should be

probably -> _GT or -> Any -- unclear.

System information

  • OS:
  • python version: 3.13.1
  • django version: 5.2.1
  • mypy version: 1.15.0
  • django-stubs version: latest (forked)
  • django-stubs-ext version: latest (forked)

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