Opened 7 years ago
Closed 7 years ago
#28391 closed Bug (fixed)
Cast doesn't take into account CharField's max_length on MySQL.
Reported by: | Mariusz Felisiak | Owned by: | Mariusz Felisiak |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | Cast |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Correct behavior, e.g. (based on db_functions/test_cast.py
):
>>> Author.objects.create(name='Bob', age=1111) >>> numbers = Author.objects.annotate(cast_string=Cast('age', models.CharField(max_length=3))) >>> numbers.get().cast_string 111
on MySQL it returns 1111
(related with #28371).
Attachments (1)
Change History (4)
by , 7 years ago
Attachment: | 28391.diff added |
---|
comment:1 by , 7 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 7 years ago
Has patch: | set |
---|
Note:
See TracTickets
for help on using tickets.
PR