1
0
Fork 0

Fixes editing links

This commit is contained in:
Mouse Reeve 2022-11-25 08:28:45 -08:00
parent 9dd0e22a47
commit 81ab08aaa3
4 changed files with 39 additions and 16 deletions

View file

@ -36,13 +36,16 @@ class FileLinkForm(CustomForm):
"This domain is blocked. Please contact your administrator if you think this is an error."
),
)
elif models.FileLink.objects.filter(
if (
not self.instance
and models.FileLink.objects.filter(
url=url, book=book, filetype=filetype
).exists():
# pylint: disable=line-too-long
self.add_error(
"url",
_(
"This link with file type has already been added for this book. If it is not visible, the domain is still pending."
),
)
).exists()
):
# pylint: disable=line-too-long
self.add_error(
"url",
_(
"This link with file type has already been added for this book. If it is not visible, the domain is still pending."
),
)