1 2 3 4 5 | def has_changed(instance, field):
if not instance.pk:
return False
old_value = instance.__class__._default_manager.filter(pk=instance.pk).values(field).get()[field]
return not getattr(instance, field) == old_value
|
More like this
- Update timestamp If any instance field has changed by craigruks 1 year, 9 months ago
- Improved Pickled Object Field by taavi223 3 years, 9 months ago
- Gravatar support in model save override by JoeLinux 3 months ago
- check if form has changed (deprecated) by guettli 5 years, 2 months ago
- Django Dictionary Model by Morgul 1 year, 11 months ago
Comments