mirror of
https://github.com/daniviga/django-ram.git
synced 2026-02-03 17:40:39 +01:00
Minor fix
This commit is contained in:
@@ -262,7 +262,12 @@ class TocEntry(BaseModel):
|
|||||||
return f"{self.title} (p. {self.page})"
|
return f"{self.title} (p. {self.page})"
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
if self.page > self.book.number_of_pages:
|
if self.page < 1:
|
||||||
raise ValidationError(
|
raise ValidationError("Page number is invalid.")
|
||||||
"Page number exceeds the publication's number of pages."
|
try:
|
||||||
)
|
if self.page > self.book.number_of_pages:
|
||||||
|
raise ValidationError(
|
||||||
|
"Page number exceeds the publication's number of pages."
|
||||||
|
)
|
||||||
|
except TypeError:
|
||||||
|
pass # number_of_pages is None
|
||||||
|
|||||||
Reference in New Issue
Block a user