Custom model field methods need to handle None, doc should say so
|Reported by:||anonymous||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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 Changed 4 years ago by gabrielhurley
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted
comment:2 Changed 3 years ago by Tim Graham <timograham@…>
- Resolution set to fixed
- Status changed from new to closed