django-smart-save is a Django app that provides a simple abstract model that will only save your model object if it is new, one or more fields have been changed locally, or it is specifically instructed to do so. Every field type is inspected for changes aside from ManyToManyFields which do not require a separate call to save. Using django-smart-save can be a provide great performance improvements in the right situations.
Install from PyPI:
pip install django-smart-save
Install from GitHub:
git clone git://github.com/derek-schaefer/django-smart-save.git
pip install -e git+git://github.com/derek-schaefer/django-smart-save.git#egg=smart_save
Add smart_save to your PYTHONPATH and INSTALLED_APPS setting:
INSTALLED_APPS = (
(Optional) Use the model-specific configuration settings:
SMART_SAVE_FORCE = True # skips dirty field checking
SMART_SAVE_IGNORE_FIELDS = ('last_updated',) # will not mark these fields as dirty
Simply subclass SmartSaveModel. Model-specific options are documented above.:
from smart_save.models import SmartSaveModel
Aside from the SMART_SAVE_FORCE model attribute, you can also pass force=True to your model's save method to skip field checking.