|
|
|
|
260
|
@classmethod
|
260
|
@classmethod
|
261
|
def from_dict(cls, data: dict) -> "Consumption":
|
261
|
def from_dict(cls, data: dict) -> "Consumption":
|
262
|
""" Reconstruct a Consumption from a dict. """
|
262
|
""" Reconstruct a Consumption from a dict. """
|
|
|
263
|
+ datetime_format = '%Y-%m-%dT%H:%M:%S.%f'
|
|
|
264
|
+ # 2018-08-31T17:30:47.871521
|
263
|
return cls(
|
265
|
return cls(
|
264
|
consumption_id=data["consumption_id"],
|
266
|
consumption_id=data["consumption_id"],
|
265
|
person_id=data["person_id"],
|
267
|
person_id=data["person_id"],
|
266
|
consumption_type_id=data["consumption_type_id"],
|
268
|
consumption_type_id=data["consumption_type_id"],
|
267
|
settlement_id=data["settlement_id"],
|
269
|
settlement_id=data["settlement_id"],
|
268
|
- created_at=datetime.datetime.fromisoformat(data["created_at"]),
|
|
|
|
|
270
|
+ created_at=datetime.datetime.strptime(data["created_at"],
|
|
|
271
|
+ datetime_format),
|
269
|
reversed=data["reversed"],
|
272
|
reversed=data["reversed"],
|
270
|
)
|
273
|
)
|
271
|
|
274
|
|