round 3
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
# python
|
||||
from dataclasses import dataclass
|
||||
from models.base import BaseModel
|
||||
|
||||
@@ -9,12 +10,15 @@ class Image(BaseModel):
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, d: dict):
|
||||
obj = cls(
|
||||
# Supports overriding base fields (id, created_at, updated_at) if present
|
||||
return cls(
|
||||
type=d.get('type'),
|
||||
extension=d.get('extension'),
|
||||
permanent=d.get('permanent', False)
|
||||
permanent=d.get('permanent', False),
|
||||
id=d.get('id'),
|
||||
created_at=d.get('created_at'),
|
||||
updated_at=d.get('updated_at')
|
||||
)
|
||||
return cls._apply_base_fields(obj, d)
|
||||
|
||||
def to_dict(self):
|
||||
base = super().to_dict()
|
||||
|
||||
Reference in New Issue
Block a user