Skip to content

Instantly share code, notes, and snippets.

@klen
Created June 1, 2011 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klen/1001973 to your computer and use it in GitHub Desktop.
Save klen/1001973 to your computer and use it in GitHub Desktop.
from django.db import models
class Entry(models.Model):
title = models.CharField()
active = models.BooleanField()
def __init__(self, *args, **kwargs):
super(Entry, self).__init__(*args, **kwargs)
# Save field state
self.__active = self.active
def save(self, **kwargs):
super(Entry, self).save(**kwargs)
if not self.__active == self.active:
# Do some works
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment