Created
June 1, 2011 08:23
-
-
Save klen/1001973 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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