Opened 3 years ago
Last modified 3 years ago
#34480 closed Bug
Annotating with Chr raises ValueError — at Version 1
| Reported by: | Jacob Walls | Owned by: | Jacob Walls |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 4.2 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
>>> 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.
Note:
See TracTickets
for help on using tickets.