mirror of
https://github.com/sissbruecker/linkding
synced 2024-11-10 06:04:15 +00:00
Fix inconsistent tag order in bookmarks (#819)
This commit is contained in:
parent
b30486317d
commit
cb0301fd9e
2 changed files with 18 additions and 1 deletions
|
@ -84,7 +84,8 @@ class Bookmark(models.Model):
|
|||
|
||||
@property
|
||||
def tag_names(self):
|
||||
return [tag.name for tag in self.tags.all()]
|
||||
names = [tag.name for tag in self.tags.all()]
|
||||
return sorted(names)
|
||||
|
||||
def __str__(self):
|
||||
return self.resolved_title + " (" + self.url[:30] + "...)"
|
||||
|
|
|
@ -457,6 +457,22 @@ class BookmarkListTemplateTest(TestCase, BookmarkFactoryMixin, HtmlTestMixin):
|
|||
style = bookmark_list["style"]
|
||||
self.assertIn("--ld-bookmark-description-max-lines:3;", style)
|
||||
|
||||
def test_bookmark_tag_ordering(self):
|
||||
bookmark = self.setup_bookmark()
|
||||
tag3 = self.setup_tag(name="tag3")
|
||||
tag1 = self.setup_tag(name="tag1")
|
||||
tag2 = self.setup_tag(name="tag2")
|
||||
bookmark.tags.add(tag3, tag1, tag2)
|
||||
|
||||
html = self.render_template()
|
||||
soup = self.make_soup(html)
|
||||
tags = soup.select_one(".tags")
|
||||
tag_links = tags.find_all("a")
|
||||
self.assertEqual(len(tag_links), 3)
|
||||
self.assertEqual(tag_links[0].text, "#tag1")
|
||||
self.assertEqual(tag_links[1].text, "#tag2")
|
||||
self.assertEqual(tag_links[2].text, "#tag3")
|
||||
|
||||
def test_should_render_web_archive_link_with_absolute_date_setting(self):
|
||||
bookmark = self.setup_date_format_test(
|
||||
UserProfile.BOOKMARK_DATE_DISPLAY_ABSOLUTE,
|
||||
|
|
Loading…
Reference in a new issue