1👍
In the end, I just did an end-around:
from django.db import connection
cursor = connection.cursor()
cursor.execute("update %s set modified='%s' where id=%s" % (
my_model._meta.db_table, desired_modified_date, my_model.id))
0👍
You cannot. Not in the sense you’re asking.
What you can is create a fake field and populate it on clean()
.
Class MyModel(models.Model):
def clean(self):
self._modified = self.modified
...
@receiver(pre_save, sender=MyModel)
def receiver_(self, *args, **kwargs):
self.modified = self._modified
So you’re backing up the field value and putting it back later. notes: ensure your application is loaded later.
- [Answer]-Problems with linking to views in Django
- [Answer]-Trying to make a Django / Mezzanine "Page last updated by on date"
- [Answer]-Modifying CSS for a Django Column Width
Source:stackexchange.com