#1511: [patch] History always records changes to boolean fields
-----------------------------+----------------------------------------------
Reporter:  vitaliyf         |        Owner:  adrian
Type: defect | Status: new Priority: normal | Milestone: Component: Admin interface | Version: SVN Severity: minor | Resolution: Keywords: | -----------------------------+----------------------------------------------
Comment (by Brian Jackson <[EMAIL PROTECTED]>):

I also needed this patch. Same as the last one attached here with the
addition of the float case. Without it, I was getting FloatFields changing
every time as well.


{{{
-                if not f.primary_key and
str(getattr(self.original_object, f.attname)) != str(getattr(new_object,
f.attname)):
+                if f.primary_key or getattr(f, 'auto_now', None) \
+                                 or getattr(f, 'auto_now_add', None):
+                    continue
+                newval = getattr(new_object, f.attname)
+                if type(newval) is bool:
+                    cast = bool
+                elif type(newval) is float:
+                       cast = float
+                else:
+                    cast = str
+                if cast(getattr(self.original_object, f.attname)) !=
cast(newval):
}}}

--
Ticket URL: <http://code.djangoproject.org/ticket/1511#comment:>
Django <http://code.djangoproject.org/>
The web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django 
updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to