Opened 3 years ago

Closed 3 years ago

#18649 closed Bug (needsinfo)

Object is saved as NoneType if readonly, Unicode when not readonly

Reported by: wongtsefei@… Owned by: nobody
Component: Core (Other) Version: 1.3
Severity: Normal Keywords: readonly nonetype
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I created a model with a TextField. Some privileged users will be able to enter data into the field, others will see it as readonly, when logged into the django admin. When not readonly, the model will save the empty field as Unicode. When readonly, the model will save the field as NoneType.

The lack of consistency may create problems if cleaning the data and a certain data type is expected.

Change History (1)

comment:1 Changed 3 years ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to needsinfo
  • Status changed from new to closed

I'm sorry, but there's not much I can do based on this bug report.

1) There isn't any information that could allow me to understand or reproduce the problem -- not even the definition of your model (does the TextField have blank=True? null=True?) and of your admin.

2) It appears that you're confusing models and forms: "When [the form is] readonly, the model [the form?] will save [clean?] the field as NoneType [None?]"

3) Your description of the problem is vague: "[it] may create problems if cleaning the data and a certain data type is expected" -- so?

If you think there is a bug in Django, could you provide instructions for us to reproduce it? Thanks!

Note: See TracTickets for help on using tickets.
Back to Top