MyModel.objects.filter(pk=obj.pk).update(...)

https://docs.djangoproject.com/en/2.1/ref/models/fields/#django.db.models.DateField.auto_now
The field is only automatically updated when calling Model.save() 
<https://docs.djangoproject.com/en/2.1/ref/models/instances/#django.db.models.Model.save>
. 
The field isn’t updated when making updates to other fields in other ways 
such as QuerySet.update() 
<https://docs.djangoproject.com/en/2.1/ref/models/querysets/#django.db.models.query.QuerySet.update>,
 
though you can specify a custom value for the field in an update like that.

среда, 13 февраля 2019 г., 10:25:54 UTC+2 пользователь Mohammad Etemaddar 
написал:
>
> I think about times that I need to edit user profiles without touching 
> auto_now field.
> How can I do it?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/21ddf025-5407-44f5-aad4-710fcf93b756%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to