Code

Ticket #1511: manipulators-bool-changed.diff

File manipulators-bool-changed.diff, 983 bytes (added by dummy@…, 8 years ago)

solution: don't check str()-values, check real values instead

Line 
1Index: manipulators.py
2===================================================================
3--- manipulators.py     (Revision 3518)
4+++ manipulators.py     (Arbeitskopie)
5@@ -109,7 +109,10 @@
6         if self.change:
7             self.fields_added, self.fields_changed, self.fields_deleted = [], [], []
8             for f in self.opts.fields:
9-                if not f.primary_key and str(getattr(self.original_object, f.attname)) != str(getattr(new_object, f.attname)):
10+                if type(getattr(new_object, f.attname)) is bool:
11+                    if not f.primary_key and getattr(self.original_object, f.attname) != getattr(new_object, f.attname):
12+                        self.fields_changed.append(f.verbose_name)
13+                elif not f.primary_key and str(getattr(self.original_object, f.attname)) != str(getattr(new_object, f.attname)):
14                     self.fields_changed.append(f.verbose_name)
15 
16         # Save many-to-many objects. Example: Set sites for a poll.