Commit 4181b86
committed
Fix CreateLabelForLabelsetMutation: drop None args so model defaults apply
The mutation passed every optional argument (description, color, icon, label_type)
through to AnnotationLabel.objects.create() unconditionally. When the caller omitted
any of them, the GraphQL kwarg defaulted to None, which Django passes to the INSERT
verbatim — bypassing the field-level default. The new NOT NULL on description (and
existing NOT NULL/default on color/icon/text) then raised an IntegrityError at
INSERT time and the catch-all returned 'Failed to create label for labelset'.
Now we filter None values before passing to .create() so model defaults apply.1 parent 131dd13 commit 4181b86
1 file changed
Lines changed: 14 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
254 | 267 | | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
| 268 | + | |
261 | 269 | | |
262 | 270 | | |
263 | 271 | | |
| |||
0 commit comments