kopia lustrzana https://github.com/jointakahe/takahe
fix Article
rodzic
7c34ac78ed
commit
4f83edd9ee
|
@ -96,7 +96,7 @@ class QuestionData(BasePostDataType):
|
||||||
|
|
||||||
class ArticleData(BasePostDataType):
|
class ArticleData(BasePostDataType):
|
||||||
type: Literal["Article"]
|
type: Literal["Article"]
|
||||||
attributed_to: str | None = Field(...)
|
attributed_to: str | None = Field(alias="attributedTo")
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
extra = "ignore"
|
extra = "ignore"
|
||||||
|
@ -110,12 +110,12 @@ class PostTypeData(BaseModel):
|
||||||
|
|
||||||
|
|
||||||
class PostTypeDataEncoder(json.JSONEncoder):
|
class PostTypeDataEncoder(json.JSONEncoder):
|
||||||
def default(self, obj):
|
def default(self, o):
|
||||||
if isinstance(obj, BasePostDataType):
|
if isinstance(o, BasePostDataType):
|
||||||
return obj.dict()
|
return o.dict()
|
||||||
elif isinstance(obj, datetime):
|
elif isinstance(o, datetime):
|
||||||
return obj.isoformat()
|
return o.isoformat()
|
||||||
return json.JSONEncoder.default(self, obj)
|
return json.JSONEncoder.default(self, o)
|
||||||
|
|
||||||
|
|
||||||
class PostTypeDataDecoder(json.JSONDecoder):
|
class PostTypeDataDecoder(json.JSONDecoder):
|
||||||
|
|
Ładowanie…
Reference in New Issue