Commits

Virgil Dupras  committed 7aca32e

Sorted up some from/from_ mixup (it's better to escape the column name at the last moment).

  • Participants
  • Parent commits 3527d22
  • Tags before-3k

Comments (0)

Files changed (1)

     # Virtual
     def _getData(self, row, column, role):
         if role in (Qt.DisplayRole, Qt.EditRole):
-            return getattr(row, column.attrname)
+            attrname = column.attrname
+            if attrname == 'from':
+                attrname = 'from_'
+            return getattr(row, attrname)
         elif role == Qt.TextAlignmentRole:
             return column.alignment
         return None
     def _setData(self, row, column, value, role):
         if role == Qt.EditRole:
             value = unicode(value.toString())
-            setattr(row, column.attrname, value)
+            attrname = column.attrname
+            if attrname == 'from':
+                attrname = 'from_'
+            setattr(row, attrname, value)
             return True
         return False
     
     def sort(self, section, order):
         column = self.COLUMNS[section]
         attrname = column.attrname
-        if attrname == 'from_':
-            attrname = 'from'
         self.model.sort_by(attrname, desc=order==Qt.DescendingOrder)
     
     def submit(self):