Is it possible to refresh the state of a django object from database? I mean behavior roughly equivalent to:
new_self = self.__class__.objects.get(pk=self.pk)
for each field of the record:
setattr(self, field, getattr(new_self, field))
UPDATE: Found a reopen/wontfix war in the tracker: http://code.djangoproject.com/ticket/901.
Still don't understand why the maintainers don't like this.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…