Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#20781 closed Bug (fixed)

Regression in form field _has_changed for fields with show_hidden_initial=True

Reported by: Tim Graham Owned by: nobody
Component: Forms Version: 1.6-beta-1
Severity: Release blocker Keywords:
Cc: Claude Paroz Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Following [892bc91cb0] (affects 1.6.X), the date_joined and last_login fields always appear as "Changed" when editing a user in the admin. It looks like it affects fields with callable defaults. In this case, django.forms.fields.Field._has_changed returns False because initial_value is a string and data_value is a datetime.

I discovered this working on #19019, the PR contains some TODOs which could be used as a regression test once this is fixed.

Change History (5)

comment:1 Changed 3 years ago by Claude Paroz

Cc: Claude Paroz added
Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

comment:2 Changed 3 years ago by Claude Paroz

Has patch: set

comment:3 Changed 3 years ago by Tim Graham

Triage Stage: AcceptedReady for checkin

It does, thanks for looking into it!

comment:4 Changed 3 years ago by Claude Paroz <claude@…>

Resolution: fixed
Status: newclosed

In 02b0106d43f6997f02cc6785359f8f7519215d3d:

Fixed #20781 -- Fixed _has_changed regression with MultiValueField

Thanks Tim Graham for the report.

comment:5 Changed 3 years ago by Claude Paroz <claude@…>

In 816bf0c6a7a13efb7ae17c9773f984f2dd16fc72:

[1.6.x] Fixed #20781 -- Fixed _has_changed regression with MultiValueField

Thanks Tim Graham for the report.
Backport of 02b0106d from master.

Note: See TracTickets for help on using tickets.
Back to Top