Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#27223 closed Bug (duplicate)

model RangeField with default value are skiped in ModelForm full_clean validation in construct_instance function

Reported by: Dariusz Paluch Owned by: nobody
Component: Forms Version: 1.10
Severity: Release blocker 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 (last modified by Dariusz Paluch)

https://github.com/django/django/commit/4bc6b939944183533ae74791d21282e613f63a96
That change in construct_instance function makes a bug with custom
full_clean validation for *RangeField like fields

RangeField values are send in POST method by two key=value pair:
my_range_0=1&my_range_1=9
that there is not my_range field in POST so field value is skipped and
not copied to instance.

Change History (4)

comment:1 Changed 3 years ago by Tim Graham

Resolution: duplicate
Status: newclosed

RangeWidget is a subclass of MultiWidget so the patch for #27186 should fix this. Could you confirm?

In investigating the other widgets in contrib.postgres, I noticed that SplitArrayWidget needs to be fixed. I'll push an update to my PR shortly.

comment:2 Changed 3 years ago by Dariusz Paluch

Description: modified (diff)

comment:3 Changed 3 years ago by Dariusz Paluch

Yes, this patch fix this.
Thank you, and I waiting for 1.10.2 shortly

comment:4 Changed 3 years ago by Dariusz Paluch

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top