I am using Django's pre_save signal to implement auto_now_add. There is a lot of discussion on the internet on why you should or shouldn't implement it yourself. I do not appreciate comments on this. Neither on whether I should be rewriting the save function (I have a lot of models that use auto_now_add so using signals makes sense).
My question is:
I would like to check if the instance is created or updated. According to some sources on the internet this can be done by testing if kwargs['created']
is True. However 'created'
does not appear in my kwargs
even though the instance is newly created.
I was just wondering if it has ever existed or that it has disappeared magically.
I know I could also test if kwargs['instance'].id
is set (this in fact works for me), but I'd like to know if kwargs['created'] still exists.