Browse Source

[models] added "str" method to VariableType

Maxime Alves LIRMM@home 4 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
             self.slabel = self.label[0]
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
     def select():
23
     def select():
20
         try:
24
         try:
21
             elt = next(super().select('slabel', 'var_type'))
25
             elt = next(super().select('slabel', 'var_type'))
22
         except StopIteration:
26
         except StopIteration:
23
             print('No element exists')
27
             print('No element exists')
24
 
28
 
29
+
25
     def save(self):
30
     def save(self):
26
         q = ['UPDATE var_type SET']
31
         q = ['UPDATE var_type SET']
27
         updates = []
32
         updates = []

Loading…
Cancel
Save