#17388 closed Cleanup/optimization (fixed)
Custom model field methods need to handle None, doc should say so
Reported by: | anonymous | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.3 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
Wrote a set of custom model fields to handle ASN.1 DER objects encoded as SQL BLOBs (don't ask). One of those custom model fields is used in a model which allows the field defined with that custom model field to be null. Boom, backtrace, bits everywhere.
In retrospect it's obvious that if the field is allowed to be null, the .to_python() and .get_prep_value() methods have to support None, but it wasn't obvious up front from the documentation.
Not a big deal, the code worked once I figured this out. I'm reporting this in the hope that it might save somebody else a bit of frustration someday.
Many thanks for a great package.
Change History (3)
comment:1 by , 13 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Sounds like a worthwhile thing to mention in the docs. Thanks for suggesting it. And like you said, I won't ask. ;-)