Merge branch 'main' into book-file-links

This commit is contained in:
Mouse Reeve
2022-01-12 06:39:22 -08:00
committed by GitHub
48 changed files with 384 additions and 198 deletions

View File

@ -492,3 +492,19 @@ class SortListForm(forms.Form):
("descending", _("Descending")),
),
)
class ReadThroughForm(CustomForm):
def clean(self):
"""make sure the email isn't in use by a registered user"""
cleaned_data = super().clean()
start_date = cleaned_data.get("start_date")
finish_date = cleaned_data.get("finish_date")
if start_date > finish_date:
self.add_error(
"finish_date", _("Reading finish date cannot be before start date.")
)
class Meta:
model = models.ReadThrough
fields = ["user", "book", "start_date", "finish_date"]