Skip to content

Validation of datetimes #22

@shuttle1987

Description

@shuttle1987

We currently have a BlogPost class that looks like this:

import typing
from datetime import datetime

from gilbert.content import Templated, Content

class BlogPost(Templated, Content):
	title: str
	authors: list
	posted: datetime
	modified: typing.Union[None, datetime]
	category: str
	tags: list
	template: str = "blog/post.html"
	summary: str
	draft: bool

We want to make sure a posted item (the post date) contains a proper datetime.
The following contains no posted however it seems to pass through the validation with no issues:

content_type: BlogPost
title: My Third Post!
authors: 
- Alysha
category: software
summary: A short description
---

Hello!

Is there something we are getting wrong in our BlogPost definition here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions