Browse Source

Fix creating ConsumptionType model

Maarten van den Berg 6 years ago
parent
commit
dde60fe376
1 changed files with 3 additions and 3 deletions
  1. 3 3
      piket_client/model.py

+ 3 - 3
piket_client/model.py

133
     consumption_type_id: int = None
133
     consumption_type_id: int = None
134
     icon: str = None
134
     icon: str = None
135
 
135
 
136
-    def create(self) -> "Person":
136
+    def create(self) -> "ConsumptionType":
137
         """ Create a new ConsumptionType from the current attributes. As tuples
137
         """ Create a new ConsumptionType from the current attributes. As tuples
138
         are immutable, a new ConsumptionType with the correct id is returned.
138
         are immutable, a new ConsumptionType with the correct id is returned.
139
         """
139
         """
158
             )
158
             )
159
             return None
159
             return None
160
 
160
 
161
-        return Person.from_dict(data["consumption_type"])
161
+        return ConsumptionType.from_dict(data["consumption_type"])
162
 
162
 
163
     @classmethod
163
     @classmethod
164
     def get(cls, consumption_type_id: int) -> "ConsumptionType":
164
     def get(cls, consumption_type_id: int) -> "ConsumptionType":
215
     @classmethod
215
     @classmethod
216
     def from_dict(cls, data: dict) -> "ConsumptionType":
216
     def from_dict(cls, data: dict) -> "ConsumptionType":
217
         """ Reconstruct a ConsumptionType from a dict. """
217
         """ Reconstruct a ConsumptionType from a dict. """
218
-        return ConsumptionType(
218
+        return cls(
219
             name=data["name"],
219
             name=data["name"],
220
             consumption_type_id=data["consumption_type_id"],
220
             consumption_type_id=data["consumption_type_id"],
221
             icon=data.get("icon"),
221
             icon=data.get("icon"),