diff --git a/src/plette/models.py b/src/plette/models.py index 485a853..ca7fa54 100644 --- a/src/plette/models.py +++ b/src/plette/models.py @@ -57,6 +57,12 @@ def __getitem__(self, key): value = self.__dict__[key] return value + def get(self, key, default=None): + try: + return self[key] + except KeyError: + return default + @dataclass class Hash(BaseModel):