From 4f83edd9eecbc802572a7ba1cda5161c87460ecf Mon Sep 17 00:00:00 2001 From: Henri Dickson <90480431+alphatownsman@users.noreply.github.com> Date: Sat, 24 Feb 2024 10:39:38 -0500 Subject: [PATCH] fix Article --- activities/models/post_types.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/activities/models/post_types.py b/activities/models/post_types.py index 8db2dc8..ab76854 100644 --- a/activities/models/post_types.py +++ b/activities/models/post_types.py @@ -96,7 +96,7 @@ class QuestionData(BasePostDataType): class ArticleData(BasePostDataType): type: Literal["Article"] - attributed_to: str | None = Field(...) + attributed_to: str | None = Field(alias="attributedTo") class Config: extra = "ignore" @@ -110,12 +110,12 @@ class PostTypeData(BaseModel): class PostTypeDataEncoder(json.JSONEncoder): - def default(self, obj): - if isinstance(obj, BasePostDataType): - return obj.dict() - elif isinstance(obj, datetime): - return obj.isoformat() - return json.JSONEncoder.default(self, obj) + def default(self, o): + if isinstance(o, BasePostDataType): + return o.dict() + elif isinstance(o, datetime): + return o.isoformat() + return json.JSONEncoder.default(self, o) class PostTypeDataDecoder(json.JSONDecoder):