mirror of
https://github.com/sissbruecker/linkding.git
synced 2025-08-07 18:58:30 +02:00
Allow pre-filling tags in new bookmark form (#1060)
* feat - Allow tag_string as query for BookmarkForm in order to set tags via bookmark snippets * add test --------- Co-authored-by: Sascha Ißbrücker <sascha.issbruecker@gmail.com>
This commit is contained in:
@@ -41,6 +41,7 @@ class BookmarkForm(forms.ModelForm):
|
|||||||
"title": request.GET.get("title"),
|
"title": request.GET.get("title"),
|
||||||
"description": request.GET.get("description"),
|
"description": request.GET.get("description"),
|
||||||
"notes": request.GET.get("notes"),
|
"notes": request.GET.get("notes"),
|
||||||
|
"tag_string": request.GET.get("tags"),
|
||||||
"auto_close": "auto_close" in request.GET,
|
"auto_close": "auto_close" in request.GET,
|
||||||
"unread": request.user_profile.default_mark_unread,
|
"unread": request.user_profile.default_mark_unread,
|
||||||
}
|
}
|
||||||
|
@@ -110,6 +110,19 @@ class BookmarkNewViewTestCase(TestCase, BookmarkFactoryMixin):
|
|||||||
html,
|
html,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_should_prefill_tags_from_url_parameter(self):
|
||||||
|
response = self.client.get(
|
||||||
|
reverse("linkding:bookmarks.new") + "?tags=tag1%20tag2%20tag3"
|
||||||
|
)
|
||||||
|
html = response.content.decode()
|
||||||
|
|
||||||
|
self.assertInHTML(
|
||||||
|
'<input type="text" name="tag_string" value="tag1 tag2 tag3" '
|
||||||
|
'class="form-input" autocomplete="off" autocapitalize="off" '
|
||||||
|
'id="id_tag_string">',
|
||||||
|
html,
|
||||||
|
)
|
||||||
|
|
||||||
def test_should_prefill_notes_from_url_parameter(self):
|
def test_should_prefill_notes_from_url_parameter(self):
|
||||||
response = self.client.get(
|
response = self.client.get(
|
||||||
reverse("linkding:bookmarks.new")
|
reverse("linkding:bookmarks.new")
|
||||||
|
Reference in New Issue
Block a user