#36847: FileField(upload_to=...) callback no longer sees `auto_now_add ` field
-------------------------------------+-------------------------------------
Reporter: Ran Benita | Owner: Nilesh
| Pahari
Type: Bug | Status: closed
Component: Database layer | Version: 6.0
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: upload_to, | Triage Stage: Ready for
auto_now_add, pre_save | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Natalia <124304+nessita@…>):
In [changeset:"77b306ea0fea54ed440a369dc38161331602386c" 77b306ea]:
{{{#!CommitTicketReference repository=""
revision="77b306ea0fea54ed440a369dc38161331602386c"
[6.0.x] Fixed #36847 -- Ensured auto_now_add fields are set on pre_save().
Regression in 94680437a45a71c70ca8bd2e68b72aa1e2eff337. Refs #27222.
During INSERT operations, `field.pre_save()` is called to prepare values
for db insertion. The `add` param must be `True` for `auto_now_add`
fields to be populated. The regression commit passed `False`, causing
`auto_now_add` fields to remain `None` when used by other fields, such
as `upload_to` callables.
Thanks Ran Benita for the report.
Backport of fe189dc43ab3eddbbceefb6834893b73ca60d5ed from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36847#comment:22>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019c09fb5023-82913a59-b077-4a2a-97fa-b09b04a29e8f-000000%40eu-central-1.amazonses.com.