Suggestion: Add optional validation to prevent future dates in DateFields used in blog-like pages · Issue #13113 · wagtail/wagtail · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes. During user testing, I found that when creating a custom page type such as BlogPage with a models.DateField, Wagtail allows the user to input and publish a page with a date in the future (e.g., 2026-10-08). While this is technically allowed by Django, it may lead to unintended behavior in CMS contexts, where a future publication date usually implies scheduled publishing — or at least requires extra editorial attention.
This can be misleading to editors or content creators, especially if the date is displayed on the site and suggests content that hasn't been written yet. In my test scenario, the page was published immediately even though the date was far in the future.
Describe the solution you'd like
An optional validation mechanism or configuration to restrict future dates in DateFields could be helpful — especially for common use cases like blogs, news articles, and events. Ideally, this could be implemented as:
A default validation toggle (allow_future_dates=False) at the field or page level.
Or a documentation example on how to restrict future dates using clean() or Panel hooks.
This way, developers and content managers can choose whether future dates are valid for their use case.
Describe alternatives you've considered
Adding custom validation to the clean() method of the model (which works but requires extra effort for each developer).
Using the Wagtail scheduling system, which is separate from the page content’s date field.
Accepting this as intended behavior, although it can confuse users and result in content showing with inaccurate dates.
Additional context
This was discovered as part of my manual test case (creating a blog post with a future date) in a Wagtail 5.2.1 + Django 5.2 environment. The result was that the page published normally, despite the future date. In my test plan, this was marked as a failed case because the behavior did not match editorial expectations.
It might help if future dates were either flagged or required to be handled differently (e.g., scheduled publishing).
Working on this
I'm not planning to work on this feature myself, but I'm happy to test any proposed solutions or contribute feedback during development.
The text was updated successfully, but these errors were encountered:
This should be possible through a Django validator, or a custom form with a clean method. Definitely in favour of better documentation for this, and maybe having Wagtail provide a standard 'future date' / 'past date' validator - I guess this would be a wrapper around Django's MaxValueValidator / MinValueValidator with a callable to return today's date. (It's a little surprising that Django doesn't provide this as a built-in...)
Is your proposal related to a problem?
Yes. During user testing, I found that when creating a custom page type such as
BlogPage
with amodels.DateField
, Wagtail allows the user to input and publish a page with a date in the future (e.g., 2026-10-08). While this is technically allowed by Django, it may lead to unintended behavior in CMS contexts, where a future publication date usually implies scheduled publishing — or at least requires extra editorial attention.This can be misleading to editors or content creators, especially if the date is displayed on the site and suggests content that hasn't been written yet. In my test scenario, the page was published immediately even though the date was far in the future.
Describe the solution you'd like
An optional validation mechanism or configuration to restrict future dates in DateFields could be helpful — especially for common use cases like blogs, news articles, and events. Ideally, this could be implemented as:
allow_future_dates=False
) at the field or page level.clean()
orPanel
hooks.This way, developers and content managers can choose whether future dates are valid for their use case.
Describe alternatives you've considered
clean()
method of the model (which works but requires extra effort for each developer).date
field.Additional context
This was discovered as part of my manual test case (creating a blog post with a future date) in a Wagtail 5.2.1 + Django 5.2 environment. The result was that the page published normally, despite the future date. In my test plan, this was marked as a failed case because the behavior did not match editorial expectations.
It might help if future dates were either flagged or required to be handled differently (e.g., scheduled publishing).
Working on this
I'm not planning to work on this feature myself, but I'm happy to test any proposed solutions or contribute feedback during development.
The text was updated successfully, but these errors were encountered: