feat: group people by role priority

This commit is contained in:
mohamad
2026-10-29 03:53:39 +08:00
parent 7c186b4230
commit 641f4e6cee
15 changed files with 186 additions and 45 deletions
+14 -6
View File
@@ -44,11 +44,14 @@ class AboutViewTest(TestCase):
AboutSectionItem.objects.create(section=section, title="Advisor", role="Scientific advisor", content="Advisor profile", order=1)
AboutSectionItem.objects.create(section=section, title="Collaborator", role="Collaborator", content="Collaboration profile", read_more_content=True, order=3)
AboutSectionItem.objects.create(section=section, title="Organizer", role="Organizer", content="Organizer profile", order=9)
AboutSectionItem.objects.create(section=section, title="Leader", role="Leader", content="Leader profile", order=20)
html = self.client.get(reverse("pages:about")).content.decode()
self.assertIn("People behind the work", html)
self.assertIn("Scientific advisor", html)
self.assertLess(html.index(">Organizer</h3>"), html.index(">Collaborator</h3>"))
self.assertLess(html.index(">Collaborator</h3>"), html.index(">Advisor</h3>"))
self.assertLess(html.index(">Leader</h4>"), html.index(">Organizer</h4>"))
self.assertLess(html.index(">Organizer</h4>"), html.index(">Collaborator</h4>"))
self.assertLess(html.index(">Collaborator</h4>"), html.index(">Advisor</h4>"))
self.assertIn("Lead / Leader", html)
self.assertIn('data-readmore="200"', html)
self.assertEqual(html.count('data-readmore="88"'), 1)
@@ -113,10 +116,15 @@ class BlogViewTest(TestCase):
BlogPostPartner.objects.create(post=self.post, role=BlogPostPartner.COLLABORATOR, name="Second collaborator", order=2)
BlogPostPartner.objects.create(post=self.post, role=BlogPostPartner.COLLABORATOR, name="First collaborator", order=1)
BlogPostPartner.objects.create(post=self.post, role=BlogPostPartner.ORGANIZER, name="Organizer", order=9)
BlogPostPartner.objects.create(post=self.post, role="Lead", name="Lead", order=5)
BlogPostPartner.objects.create(post=self.post, role="Leader", name="Leader", order=1)
html = self.client.get(self.post.get_absolute_url()).content.decode()
self.assertLess(html.index('class="blog-article rich-content'), html.index('class="blog-partners"'))
self.assertLess(html.index('>Organizer</h3>'), html.index('>First collaborator</h3>'))
self.assertLess(html.index('>First collaborator</h3>'), html.index('>Second collaborator</h3>'))
self.assertLess(html.index('>Leader</h4>'), html.index('>Lead</h4>'))
self.assertLess(html.index('>Lead</h4>'), html.index('>Organizer</h4>'))
self.assertLess(html.index('>Organizer</h4>'), html.index('>First collaborator</h4>'))
self.assertLess(html.index('>First collaborator</h4>'), html.index('>Second collaborator</h4>'))
self.assertLess(html.index('Lead / Leader'), html.index('>Organizers</h3>'))
def test_partner_headings_are_shared_and_description_read_more_is_independent(self):
branding = SiteBranding.load()
@@ -152,8 +160,8 @@ class BlogViewTest(TestCase):
BlogPostPartner.objects.create(post=self.post, role=BlogPostPartner.ORGANIZER, name="Lead", order=9)
html = self.client.get(self.post.get_absolute_url()).content.decode()
self.assertIn("Scientific advisor", html)
self.assertLess(html.index(">Lead</h3>"), html.index(">Partner</h3>"))
self.assertLess(html.index(">Partner</h3>"), html.index(">Advisor</h3>"))
self.assertLess(html.index(">Lead</h4>"), html.index(">Partner</h4>"))
self.assertLess(html.index(">Partner</h4>"), html.index(">Advisor</h4>"))
class ContactViewTest(TestCase):