Commit d92b8c4
committed
fix: editing of FlagField via EnumFlagField form field
When attempting to edit an EnumFlagField through a model form (e.g. in django
admin), the form would always be invalid on submit with an invalid_choice error.
This was due to the form attempting to set the model field to a list of enum
members (rather than bitwise-OR'ing the flags together).
This change handles this case by overriding FlagField._coerce_to_value_type and
performing the appropriate bitwise OR there.1 parent 0c5b9e1 commit d92b8c4
1 file changed
+9
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1215 | 1215 | | |
1216 | 1216 | | |
1217 | 1217 | | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
1218 | 1227 | | |
1219 | 1228 | | |
1220 | 1229 | | |
| |||
0 commit comments