#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 aractru):
Hello,
I've been upgrading to 6.0.2 and have been inconsistently running into
this issue. I've seen it happen about 3 times while running unit tests.
I'd say this is almost rare, but our tests call into this code so many
times that I've been able to get this error every time I run all the tests
collectively so far. That may be a confusing statement. Suffice it to
say, I haven't run all the tests a lot so far as I'm working through other
issues during this upgrade.
I get the following error message:
{{{
django.db.utils.IntegrityError: NOT NULL constraint failed:
promo_codes.date_created
}}}
while the class is setup like this:
{{{
class PromoCodes(TranslatableModel):
...
date_created = models.DateTimeField(auto_now_add=True, blank=False)
}}}
The code is crashing when I call pc.save()
{{{
pc = PromoCodes(
promo_code=referral_code,
promo_type=PromoCodes.REFERRAL_CODE,
created_by=u,
status=PromoCodes.ACTIVE_STATUS,
)
pc.save()
}}}
If you need more information, please contact soon. I am likely to
downgrade to 5.2 soon to complete my work.
Below are the relevant libraries, using python 3.14.3
{{{
dj-database-url==3.1.2
Django==6.0.2
django-environ==0.13.0
django-storages==1.14.6
djangorestframework==3.16.1
django-cors-headers==4.9.0
django-parler==2.3
pylint-django==2.7.0
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36847#comment:23>
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/0107019cb0a0085e-408535c1-d302-4ade-9a80-0f6ef5495684-000000%40eu-central-1.amazonses.com.