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:
Sascha Ißbrücker
2021-02-06 16:27:19 +01:00
committed by GitHub
parent 085027b00a
commit 91d876a7f1
8 changed files with 179 additions and 8 deletions

View File

@@ -5,6 +5,7 @@ from django.contrib.auth import get_user_model
from django.db import models
from bookmarks.utils import unique
from bookmarks.validators import BookmarkURLValidator
class Tag(models.Model):
@@ -32,7 +33,7 @@ def build_tag_string(tag_names: List[str], delimiter: str = ','):
class Bookmark(models.Model):
url = models.URLField(max_length=2048)
url = models.CharField(max_length=2048, validators=[BookmarkURLValidator()])
title = models.CharField(max_length=512, blank=True)
description = models.TextField(blank=True)
website_title = models.CharField(max_length=512, blank=True, null=True)
@@ -76,7 +77,7 @@ class Bookmark(models.Model):
class BookmarkForm(forms.ModelForm):
# Use URLField for URL
url = forms.URLField()
url = forms.CharField(validators=[BookmarkURLValidator()])
tag_string = forms.CharField(required=False)
# Do not require title and description in form as we fill these automatically if they are empty
title = forms.CharField(max_length=512,