smn/django-dirtyfields — pull request #5 by jimrollenhagen (2012-03-29 19:00:19+00:00)
Title: Use field.to_python to do django type conversions on the field before ch...

...ecking if dirty.

This solves issues where you might have a decimal field that you write a string to, eg:
>>> m = MyModel.objects.get(id=1)
>>> m.my_decimal_field
Decimal('1.00')
>>> m.my_decimal_field = u'1.00' # from a form or something
>>> m.is_dirty() # currently evaluates to True, should evaluate to False
False

This pull request could probably use some unit testing, but it should be safe as the base class for django fields defines to_python as:

def to_python(self, value):
return value

So, any field type that does not have an explicit to_python method will behave as before this change.