Why does django-lint tell me the `auto_now_add` is deprecated?

后端 未结 2 882
花落未央
花落未央 2021-01-02 11:01

Hi fellow Djangonauts:

I checked my project with django-lint, and it yields:

W:211,16:MyModel: timestamp: Uses superceded auto_now or auto_now_add
         


        
2条回答
  •  爱一瞬间的悲伤
    2021-01-02 11:22

    auto_now and auto_now_add are considered harmful, because you have absolutely no way to change the value via django (say for example, in the admin interface).

    This is an inconsitency with other flags, and django people generally don't like that sort of magic.

提交回复
热议问题