mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-04 07:16:36 +00:00
WIP: fix reading status ending in the future
This commit is contained in:
parent
44ce12405b
commit
68b9791d8c
1 changed files with 10 additions and 1 deletions
|
@ -6,7 +6,7 @@ from django.utils.translation import gettext_lazy as _
|
||||||
from bookwyrm import models
|
from bookwyrm import models
|
||||||
from bookwyrm.models.user import FeedFilterChoices
|
from bookwyrm.models.user import FeedFilterChoices
|
||||||
from .custom_form import CustomForm
|
from .custom_form import CustomForm
|
||||||
|
import datetime
|
||||||
|
|
||||||
# pylint: disable=missing-class-docstring
|
# pylint: disable=missing-class-docstring
|
||||||
class FeedStatusTypesForm(CustomForm):
|
class FeedStatusTypesForm(CustomForm):
|
||||||
|
@ -58,6 +58,15 @@ class ReadThroughForm(CustomForm):
|
||||||
self.add_error(
|
self.add_error(
|
||||||
"stopped_date", _("Reading stopped date cannot be before start date.")
|
"stopped_date", _("Reading stopped date cannot be before start date.")
|
||||||
)
|
)
|
||||||
|
current_time = datetime.datetime.now()
|
||||||
|
if current_time < stopped_date:
|
||||||
|
self.add_error(
|
||||||
|
"stopped_date", _("Reading stopped date cannot be in the future.")
|
||||||
|
)
|
||||||
|
if current_time < finish_date:
|
||||||
|
self.add_error(
|
||||||
|
"finished_date", _("Reading finished date cannot be in the future.")
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.ReadThrough
|
model = models.ReadThrough
|
||||||
|
|
Loading…
Reference in a new issue