Skip to content

Commit

Permalink
Added latest DSF board meeting minutes to complementary sidebar.
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahboyce authored and bmispelon committed Jan 18, 2025
1 parent 2d19190 commit 4fbcf7d
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 20 deletions.
2 changes: 1 addition & 1 deletion djangoproject/scss/_style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1459,7 +1459,7 @@ a.cta {
margin-bottom: 5px;
}

li {
> li {
border-top: 1px solid var(--hairline-color);
margin-top: 35px;
padding-top: 10px;
Expand Down
5 changes: 4 additions & 1 deletion djangoproject/templates/base_foundation.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "base.html" %}
{% load fundraising_extras %}
{% load fundraising_extras meetings i18n %}

{% block og_title %}Django Software Foundation{% endblock %}

Expand All @@ -25,5 +25,8 @@ <h2>About the foundation</h2>
<li><a href="/foundation/cla/">Contributor license agreements</a></li>
<li><a href="/foundation/conferences/">Organizing a Django conference</a></li>
</ul>
<h3>{% translate "Latest DSF meeting minutes" %}</h3>
{% render_latest_meeting_minute_entries 2 %}
<a href="{% url 'foundation_meeting_archive_index' %}" class="link-readmore">{% translate "More meeting minutes" %}</a>
</div>
{% endblock %}
25 changes: 25 additions & 0 deletions djangoproject/templates/foundation/meeting_snippet.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{% load i18n %}
<ul class="list-news">
{% for m in meetings %}
<li>
<h4>
<a href="{{ m.get_absolute_url }}">{{ m }}</a>
</h4>
{% with m.business.all as businesses %}
{% if businesses %}
<div class="meta">
<b>{% translate "New and Ongoing business" %}</b>
<ul>
{% for b in businesses %}
<li>{{ b.title }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endwith %}
<a class="link-readmore" href="{{ m.get_absolute_url }}">
{% translate "Read more" context "Following meeting minutes summary" %}
</a>
</li>
{% endfor %}
</ul>
Empty file.
11 changes: 11 additions & 0 deletions foundation/templatetags/meetings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django import template

from ..models import Meeting

register = template.Library()


@register.inclusion_tag("foundation/meeting_snippet.html")
def render_latest_meeting_minute_entries(num):
meetings = Meeting.objects.order_by("-date").prefetch_related("business")[:num]
return {"meetings": meetings}
72 changes: 54 additions & 18 deletions foundation/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,23 @@
from django.urls import reverse
from djmoney.money import Money

from .models import ApprovedGrant, BoardMember, Meeting, Office, Term
from .models import ApprovedGrant, BoardMember, Business, Meeting, Office, Term


class MeetingTestCase(TestCase):
@classmethod
def setUpTestData(cls):
cls.user = User.objects.create_superuser(
"admin", "[email protected]", "password"
)
cls.member = BoardMember.objects.create(
account=cls.user,
office=Office.objects.create(name="treasurer"),
term=Term.objects.create(year=2023),
)

def test_meeting_initial(self):
user = User.objects.create_superuser("admin", "[email protected]", "password")
self.client.force_login(user)
self.client.force_login(self.user)
response = self.client.get(reverse("admin:foundation_meeting_add"))
self.assertContains(response, "DSF Board monthly meeting")
self.assertContains(response, "dsf-board-monthly-meeting")
Expand All @@ -20,17 +30,11 @@ def test_meeting_minutes_feed(self):
"""
Make sure that the meeting minutes RSS feed works
"""
user = User.objects.create_superuser("admin", "[email protected]", "password")
member = BoardMember.objects.create(
account=user,
office=Office.objects.create(name="treasurer"),
term=Term.objects.create(year=2023),
)
Meeting.objects.create(
date=date.today(),
title="DSF Board monthly meeting",
slug="dsf-board-monthly-meeting",
leader=member,
leader=self.member,
treasurer_report="Hello World",
)

Expand All @@ -39,18 +43,11 @@ def test_meeting_minutes_feed(self):
self.assertIn(b"DSF Board monthly meeting", response.content)

def test_meeting_details(self):
user = User.objects.create_superuser("admin", "[email protected]", "password")
self.client.force_login(user)
member = BoardMember.objects.create(
account=user,
office=Office.objects.create(name="treasurer"),
term=Term.objects.create(year=2023),
)
meeting = Meeting.objects.create(
date=date(2023, 1, 12),
title="DSF Board monthly meeting",
slug="dsf-board-monthly-meeting",
leader=member,
leader=self.member,
treasurer_report="Hello World",
)
ApprovedGrant.objects.create(
Expand All @@ -77,3 +74,42 @@ def test_meeting_details(self):
self.assertContains(response, "DSF Board monthly meeting")
self.assertContains(response, "USD $10,000.00")
self.assertContains(response, "EUR €5,000.00")

def test_latest_meeting_minutes(self):
common_meeting_data = {
"slug": "dsf-board-monthly-meeting",
"leader": self.member,
"treasurer_report": "Hello World",
"title": "DSF Board monthly meeting",
}
latest_meeting = Meeting.objects.create(
date=date(2023, 5, 12), **common_meeting_data
)
previous_meeting = Meeting.objects.create(
date=date(2023, 4, 12), **common_meeting_data
)
Meeting.objects.create(date=date(2023, 3, 12), **common_meeting_data)
common_business_data = {
"body": "Example",
"body_html": "Example",
"business_type": "New",
"meeting": latest_meeting,
}
Business.objects.create(title="Business item 1", **common_business_data)
Business.objects.create(title="Business item 2", **common_business_data)
Business.objects.create(title="Business item 3", **common_business_data)

response = self.client.get(reverse("foundation_meeting_archive_index"))

self.assertContains(response, "Latest DSF meeting minutes")

self.assertContains(response, "DSF Board monthly meeting, May 12, 2023")
self.assertContains(response, latest_meeting.get_absolute_url())
self.assertContains(response, "DSF Board monthly meeting, April 12, 2023")
self.assertContains(response, previous_meeting.get_absolute_url())
self.assertNotContains(response, "DSF Board monthly meeting, March 12, 2023")

self.assertContains(response, "New and Ongoing business", count=1)
self.assertContains(response, "Business item 1")
self.assertContains(response, "Business item 2")
self.assertContains(response, "Business item 3")

0 comments on commit 4fbcf7d

Please sign in to comment.