mirror of
https://github.com/sissbruecker/linkding.git
synced 2025-08-07 10:58:25 +02:00
Add option to disable bookmark URL validation (#57)
* Add option for disabled bookmark URL validation (#36) * Add options documentation (#36)
This commit is contained in:
14
bookmarks/validators.py
Normal file
14
bookmarks/validators.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from django.conf import settings
|
||||
from django.core import validators
|
||||
|
||||
|
||||
class BookmarkURLValidator(validators.URLValidator):
|
||||
"""
|
||||
Extends default Django URLValidator and cancels validation if it is disabled in settings.
|
||||
This allows to switch URL validation on/off dynamically which helps with testing
|
||||
"""
|
||||
def __call__(self, value):
|
||||
if settings.LD_DISABLE_URL_VALIDATION:
|
||||
return
|
||||
|
||||
super().__call__(value)
|
Reference in New Issue
Block a user