[Django] #36275: Update auto_now fields when using bulk_update

8 views
Skip to first unread message

Django

unread,
Mar 24, 2025, 1:58:39 PM3/24/25
to django-...@googlegroups.com
#36275: Update auto_now fields when using bulk_update
-------------------------------------+-------------------------------------
Reporter: Rodolfo Becerra | Type: New
| feature
Status: new | Component: Database
| layer (models, ORM)
Version: 5.1 | Severity: Normal
Keywords: auto_now, | Triage Stage:
bulk_update | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
I have seen an [[https://github.com/aykut/django-bulk-
update/issues/25|issue]] and I know that currently `bulk_update` does not
update the date fields that have the `auto_now=True` parameter when
calling
I have a suggestion to add a new parameter to the bulk_update method
`update_auto_now=True` or `auto_now=True` that updates the field if the
parameter is True (which by default it would be) and if the field has not
been previously updated before calling the method.

I would love to try this update if you guys see it viable.
--
Ticket URL: <https://code.djangoproject.com/ticket/36275>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 24, 2025, 1:59:13 PM3/24/25
to django-...@googlegroups.com
#36275: Update auto_now fields when using bulk_update
-------------------------------------+-------------------------------------
Reporter: Rodolfo Becerra | Owner: Rodolfo
| Becerra
Type: New feature | Status: assigned
Component: Database layer | Version: 5.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: auto_now, | Triage Stage:
bulk_update | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Rodolfo Becerra):

* owner: (none) => Rodolfo Becerra
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/36275#comment:1>

Django

unread,
Mar 24, 2025, 2:43:51 PM3/24/25
to django-...@googlegroups.com
#36275: Update auto_now fields when using bulk_update
-------------------------------------+-------------------------------------
Reporter: Rodolfo Becerra | Owner: Rodolfo
| Becerra
Type: New feature | Status: closed
Component: Database layer | Version: 5.1
(models, ORM) |
Severity: Normal | Resolution: invalid
Keywords: auto_now, | Triage Stage:
bulk_update | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):

* resolution: => invalid
* status: assigned => closed

Comment:

For the same reasons `update` (#15566) and `update_or_create`
(ticket:35890#comment:6) don't implicitly cover `auto_now` fields in call
cases I wouldn't expect `bulk_update` do to so either.

Given there's an open ticket to deprecate `auto_now` #22995 altogether I'm
going to close this ticket.
--
Ticket URL: <https://code.djangoproject.com/ticket/36275#comment:2>
Reply all
Reply to author
Forward
0 new messages