Opened 8 years ago
Closed 8 years ago
#27186 closed Bug (fixed)
Cannot change CheckboxSelectMultiple, FileInput, MultiWidget, SplitDateTimeWidget, and SelectDateWidget with model field default since Django 1.10.1
Reported by: | Michael Käufl | Owned by: | Tim Graham |
---|---|---|---|
Component: | Forms | Version: | 1.10 |
Severity: | Release blocker | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Since Django 1.10.1 (it worked in 1.10.0), it is not possible to change the value of a DateTimeField in the admin if the field has a default.
Changing the value and saving the object results in the old value still being in the database.
How to reproduce
I created a small example project to easily reproduce the problem.
It has a model ''Dummy'' with two DateTimeFields. One with and one without a default (django.utils.timezone.now). The admin is the default django.contrib.admin.ModelAdmin.
git clone https://github.com/michael-k/datetimefieldbroken.git && cd datetimefieldbroken docker-compose build --pull docker-compose run web migrate docker-compose run web createsuperuser docker-compose up -d
Head your browser to http://localhost:8023/admin/main/dummy/add/, login and create a new Dummy using Save and continue editing. Change the values all for input fields and press Save and continue editing again. The values of Dt with default are unchanged.
Patch that introduced the issue
We believe that PR 7068 (regarding issue 27039) introduced the problem, but did not validate this. Supposedly this happens because DateTimeField is split into two fields (date + time) in the admin.
We tried it however with Django 1.10.0 and it works just fine.
Change History (13)
comment:1 by , 8 years ago
Description: | modified (diff) |
---|
comment:2 by , 8 years ago
Description: | modified (diff) |
---|
comment:3 by , 8 years ago
Severity: | Normal → Release blocker |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Bug |
comment:4 by , 8 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:5 by , 8 years ago
Has patch: | set |
---|
comment:6 by , 8 years ago
Summary: | Cannot change DateTimeField with default via Admin since Django 1.10.1 → Cannot change FileInput, MultiWidget, SplitDateTimeWidget, and SelectDateWidget with model field default since Django 1.10.1 |
---|
comment:9 by , 8 years ago
Has patch: | unset |
---|---|
Resolution: | fixed |
Status: | closed → new |
Summary: | Cannot change FileInput, MultiWidget, SplitDateTimeWidget, and SelectDateWidget with model field default since Django 1.10.1 → Cannot change CheckboxSelectMultiple, FileInput, MultiWidget, SplitDateTimeWidget, and SelectDateWidget with model field default since Django 1.10.1 |
As reported in #27291, CheckboxSelectMultiple
is also affected.
comment:13 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
PR