#2558 closed defect (duplicate)
forms.RawIdAdminField fails with NoneType on split()
Reported by: | anonymous | Owned by: | Adrian Holovaty |
---|---|---|---|
Component: | Core (Other) | Version: | |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
A snippet of my model is that I have a 'person' who can have one or more 'address'es associated, and vice versa. (Many people live at the same address, yes?) Therefore, I have a model that requires a ManyToManyField to be treated as a raw_id_admin, because data size creates real performance issues. I also render the 'address' data on a custom form using a render_raw_admin_id in templatetags.
When adding a new instance of 'person', we do not have any 'address'es associated as yet; So when I save the 'person', I get the NoneType failure on the split.
I have managed to get around this by adding a check for None in the RawIdAdminField.html2python, and returning an empty list if true.
Am I missing the point here?
Duplicates #2579, fixed in [3803].