Opened 6 years ago

Last modified 5 years ago

#29086 closed Bug

Bytestrings on CharFields getting saved as "b'data'" — at Version 1

Reported by: Collin Anderson Owned by: nobody
Component: Database layer (models, ORM) Version: 2.0
Severity: Release blocker Keywords:
Cc: Collin Anderson Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Collin Anderson)

Django 1.11 behavior (python 3):

o = MyModel()
o.myfield = b'123'
o.save()
o.refresh_from_db()
o.myfield == "123"

Django 2.0 behavior:

o = MyModel()
o.myfield = b'123'
o.save()
o.refresh_from_db()
o.myfield == "b'123'"

Could we restore the old behavior, maybe with a deprecation warning? Either that or raise an error?

Change History (1)

comment:1 by Collin Anderson, 6 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top