edited templates
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from __future__ import annotations
|
||||
from typing import TypedDict, List
|
||||
from typing import TypedDict, List, Union
|
||||
|
||||
|
||||
class ArticleConfig(TypedDict):
|
||||
@@ -24,6 +24,14 @@ class ArticleContext(TypedDict):
|
||||
related: List[ArticleContext]
|
||||
|
||||
|
||||
class TypedLanguage(TypedDict):
|
||||
flag: str
|
||||
name: str
|
||||
native_name: str
|
||||
priority: int
|
||||
code: str
|
||||
|
||||
|
||||
class ArticleTranslationContext(TypedDict):
|
||||
slug: str
|
||||
name: str
|
||||
@@ -33,7 +41,18 @@ class ArticleTranslationContext(TypedDict):
|
||||
iso_date: str
|
||||
author: str
|
||||
|
||||
translations: List[ArticleTranslationContext]
|
||||
children: List[ArticleTranslationContext]
|
||||
linked: List[ArticleTranslationContext]
|
||||
related: List[ArticleTranslationContext]
|
||||
language: TypedLanguage
|
||||
article_url: str
|
||||
"""
|
||||
The type Union[ArticleTranslationContext, ArticleContext] exist,
|
||||
because if the article it is linked to doesn't exist in the same languages it uses the overview instead.
|
||||
If you dislike this behavior set:
|
||||
config.fall_back_to_overview_in_translation = False
|
||||
"""
|
||||
children: List[Union[ArticleTranslationContext, ArticleContext]]
|
||||
|
||||
# you can't use these within the markdown text itself
|
||||
content: str
|
||||
preview: str
|
||||
linked: List[Union[ArticleTranslationContext, ArticleContext]]
|
||||
related: List[Union[ArticleTranslationContext, ArticleContext]]
|
||||
|
||||
Reference in New Issue
Block a user