Browse Source

[models] added "str" method to VariableType

Maxime Alves LIRMM@home 3 years ago
parent
commit
6091b5835a
1 changed files with 5 additions and 0 deletions
  1. 5
    0
      pyheatpump/models/variable_type.py

+ 5
- 0
pyheatpump/models/variable_type.py View File

@@ -16,12 +16,17 @@ class VariableType(RowClass):
16 16
             self.slabel = self.label[0]
17 17
 
18 18
 
19
+    def __str__(self):
20
+        return self.slabel or self.label[0]
21
+
22
+
19 23
     def select():
20 24
         try:
21 25
             elt = next(super().select('slabel', 'var_type'))
22 26
         except StopIteration:
23 27
             print('No element exists')
24 28
 
29
+
25 30
     def save(self):
26 31
         q = ['UPDATE var_type SET']
27 32
         updates = []

Loading…
Cancel
Save