Should auto_now and auto_now_add be avoided?

Hi everyone!

I’m here to ask you all about your opinion on auto_now and auto_now_add :

created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)

I’ve been considering dropping these from my project for the following reasons:

1. No overrides (#16583)

It’s inconvenient that these fields can’t be overridden. Use-cases:

  • Tests. I want to create test records with explicit created_at / updated_at for integration tests
  • Migrations. I want to create production records with explicit created_at / updated_at when migrating historical data

I know there are ways to work around it, but it’s inconvenient to do so

2. created_at and updated_at differs slightly (#16745)

When creating a record, created_at and updated_at differs slightly

It’s not a huge issue, but it would be better if they were the same because that’s what I would expect


#22995 proposes deprecating these parameters. Also, see this django-developers discussion . It seems like the consensus used to be that these params shouldn’t be used

Personally, I like using these params. It’s nice to have an official Django feature for this. I would rather address their limitations than remove them

Question: should developers avoid using auto_now and auto_now_add?

I’ve run into some friction with these fields as well. Agreed they are a nice to have. Thanks for writing this up and the proposal!

I’ll provide a third point, but be warned it’s a mystery to me and I’m sorry if it’s actually unhelpful.

3. Not always populated
Somewhat contrary to 1. No overrides, in my tests created_at must be supplied with a value, but only for some models and only for the first instantiation of the session. Otherwise, I get this error:

django.db.utils.IntegrityError: NOT NULL constraint failed: mymodel.created_at

For context, I’m use Factory Boy, and this is what my test code looks like:

# the created_at field is inexplicably left NULL for the first call of the factory
instance = MyModelFactory(created_at="2025-08-08 08:08 -08:00")

Thanks! I use Factory Boy too, never encountered this error

Personally, I don’t think they should avoid them as much as being aware of their limitations.

I rely upon them heavily. For what I need them for, they are ideal. And, in those contexts, they have never caused problems for me.

Are they “perfect”? No. But you could probably say that about any feature in Django. However, like pretty much everything in Django, they are useful in their proper place.