Skip to content

Commit

Permalink
expose the Posts model
Browse files Browse the repository at this point in the history
  • Loading branch information
WaylonWalker committed Sep 9, 2023
1 parent c55526b commit 5ccdce7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions markata/plugins/create_models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, List

from more_itertools import unique_everseen
from pydantic import create_model
Expand All @@ -21,13 +21,17 @@ class PostConfig:


@hook_impl
@register_attr("Post", "Config")
@register_attr("Post", "Posts", "Config")
def create_models(markata: "Markata") -> None:
post_models = tuple(unique_everseen(markata.post_models))
markata.Post = create_model(
"Post",
__base__=post_models,
)
markata.Posts = create_model(
"Posts",
posts=(List[markata.Post], ...),
)
markata.Post.markata = markata
markata.Config = create_model(
"Config",
Expand Down

0 comments on commit 5ccdce7

Please sign in to comment.