Commit 84402cd
committed
Fix single-valued UID reference fields not settable through the JSON API
The UIDReferenceFieldMixin always passed a list to the field setter, even
for single-valued fields. AT UIDReferenceField validators reject a list
value ('[...] is not supported'), so assigning e.g. a Sample's
Specification, Batch or SamplePoint through the API failed. Unwrap the
list to a scalar (or None to clear) for non multi-valued fields, matching
the classic ReferenceFieldManager.1 parent 36a6caa commit 84402cd
2 files changed
Lines changed: 9 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
664 | 664 | | |
665 | 665 | | |
666 | 666 | | |
667 | | - | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
668 | 674 | | |
669 | 675 | | |
670 | 676 | | |
671 | 677 | | |
672 | | - | |
673 | | - | |
674 | | - | |
| 678 | + | |
675 | 679 | | |
676 | 680 | | |
677 | 681 | | |
| |||
0 commit comments