I'm suggesting in `Chr` we can set `output_field = CharField()` to prevent
this.
--
Ticket URL: <https://code.djangoproject.com/ticket/34480>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Old description:
> {{{
> >>> Author.objects.annotate(first_letter=Chr(Value(77)))
> File "/Users/.../geoguard/.venv/lib/python3.9/site-
> packages/django/db/models/expressions.py", line 369, in <lambda>
> else int(value)
> ValueError: invalid literal for int() with base 10: 'M'
> }}}
>
> I'm suggesting in `Chr` we can set `output_field = CharField()` to
> prevent this.
New description:
{{{
>>> Author.objects.annotate(first_letter=Chr(Value(77)))
File "/Users/.../.../.venv/lib/python3.9/site-
packages/django/db/models/expressions.py", line 369, in <lambda>
else int(value)
ValueError: invalid literal for int() with base 10: 'M'
}}}
I'm suggesting in `Chr` we can set `output_field = CharField()` to prevent
this.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/34480#comment:1>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/34480#comment:2>
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/16750 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/34480#comment:3>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/34480#comment:4>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"c3d7a71f836f7cfe8fa90dd9ae95b37b660d5aae" c3d7a71f]:
{{{
#!CommitTicketReference repository=""
revision="c3d7a71f836f7cfe8fa90dd9ae95b37b660d5aae"
Fixed #34480 -- Fixed crash of annotations with Chr().
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34480#comment:5>