mirror of
https://github.com/daniviga/django-ram.git
synced 2026-02-03 17:40:39 +01:00
Enforce page number in TOC
This commit is contained in:
@@ -275,6 +275,8 @@ class TocEntry(BaseModel):
|
||||
return f"{title} (p. {self.page})"
|
||||
|
||||
def clean(self):
|
||||
if self.page is None:
|
||||
raise ValidationError("Page number is required.")
|
||||
if self.page < 1:
|
||||
raise ValidationError("Page number is invalid.")
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user