Add support for future post publication

This commit is contained in:
Ethan Paul 2021-04-24 23:32:47 -04:00
parent 1c371e8c1f
commit cb275ad95d
No known key found for this signature in database
GPG Key ID: D0E2CBF1245E92BF
1 changed files with 6 additions and 0 deletions

View File

@ -122,6 +122,12 @@ class ConfigSerializer(msh.Schema):
f"Post slugs used multiple times: {set([item for item in slugs if slugs.count(item) > 1])}"
)
@msh.post_load
def _remove_future(self, data: Dict[str, Any], *args, **kwargs) -> PostContainer:
posts = [item for item in data["posts"] if item.date >= datetime.date.today()]
data["posts"] = posts
return data
def get_args() -> argparse.Namespace:
parser = argparse.ArgumentParser()