renaming the value manager's initial_value field to previous_value

This commit is contained in:
Blake Eggleston
2013-03-06 20:41:13 -08:00
parent 61235126bf
commit cb5945f96c
2 changed files with 13 additions and 3 deletions

View File

@@ -12,12 +12,22 @@ class BaseValueManager(object):
def __init__(self, instance, column, value):
self.instance = instance
self.column = column
self.initial_value = copy(value)
self.previous_value = copy(value)
self.value = value
@property
def deleted(self):
return self.value is None and self.initial_value is not None
return self.value is None and self.previous_value is not None
@property
def changed(self):
"""
Indicates whether or not this value has changed.
:rtype: boolean
"""
return self.value != self.previous_value
def getval(self):
return self.value

View File

@@ -62,7 +62,7 @@ class TestModelIO(BaseCassEngTestCase):
tm2 = TestModel.objects(id=tm.pk).first()
assert tm2.text is None
assert tm2._values['text'].initial_value is None
assert tm2._values['text'].previous_value is None
def test_a_sensical_error_is_raised_if_you_try_to_create_a_table_twice(self):