Skip to main content

Django fieldsignals simply makes it easy to tell when the fields on your model have changed.

Project description

.. highlightlang:: python

``django-fieldsignals`` simply makes it easy to tell when the fields on your model have changed.

Often model updates are quite expensive. Sometimes the expensive operations
are sometimes very rare. This makes it tempting to put the update logic in a view,
rather than in a save() method or in a signal receiver::

# A bad example. Don't do this!
def edit_poll(request, poll_id):

# ...

if form.cleaned_data['poll_name'] !=

That's a bad idea, because your model consistency is now dependent on your view.

Instead, use ``fieldsignals``::

from fieldsignals import pre_save_changed

def update_poll_slug(sender, instance, **kwargs):
instance.slug = slugify(

pre_save_changed.connect(update_poll_slug, sender=Poll, fields=['name'])

In case you want to know what changed, ``fieldsignals`` even tells you the old and
new values of your fields::

from fieldsignals import pre_save_changed

def print_all_field_changes(sender, instance, changed_fields=None, **kwargs):
for field, (old, new) in changed_fields.items():
print "%s changed from %s to %s" % (, old, new)

pre_save_changed.connect(print_all_field_changes, sender=Poll)


1. This library is on PyPI so you can install it with::

pip install django-fieldsignals

or from github::

pip install git+

2. Add "polls" to your INSTALLED_APPS setting like this::


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-fieldsignals, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size django_fieldsignals-0.1.1-py2-none-any.whl (5.5 kB) File type Wheel Python version 2.7 Upload date Hashes View
Filename, size django-fieldsignals-0.1.1.tar.gz (4.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page