質問

I have a model Question with an IntegerField named flags and a datetime Field called pub_date. pub_date is set to be auto_now=True.
I have a view for changing the flags field. And when I change the flags and do .save() to the Question object, its pub date changes to now.
I wan't the pub_date to be set only when it's being created and not when I'm changing some data in the record. How can I do this?
If you need to see my code, please tell me because I don't think you need to here.

役に立ちましたか?

解決

you should set auto_now_add = True

他のヒント

You can just remove auto_now=True and set the field manually when you want to, in your view.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top