Skip to content

Commit c114138

Browse files
fix: Show also diamond and platinium member in theses pages
1 parent 7f87f1a commit c114138

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

djangoproject/templates/aggregator/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,5 @@ <h2 class="bullet-icon"><i class="icon icon-rss blue"></i> {{ feedtype.name }}</
9999
{% endblock %}
100100

101101
{% block content-related-extra %}
102-
{% gold_corporate_members %}
102+
{% top_and_gold_corporate_members %}
103103
{% endblock %}

djangoproject/templates/flatpages/foundation.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ <h1>{{ flatpage.title }}</h1>
1010
{% endblock %}
1111

1212
{% block content-related-extra %}
13-
{% gold_corporate_members %}
13+
{% top_and_gold_corporate_members %}
1414
{% endblock %}

djangoproject/templates/fundraising/includes/gold_corporate_members.html renamed to djangoproject/templates/fundraising/includes/top_and_gold_corporate_members.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% if members %}
22
<div class="corporate-members">
3-
<h3>Gold Members</h3>
3+
<h3>Diamond, Platinum and Gold Members</h3>
44
{% for obj in members %}
55
<div class="clearfix">
66
<div class="member-logo">

fundraising/templatetags/fundraising_extras.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ def top_corporate_members():
120120
return {"members": members["diamond"] + members["platinum"]}
121121

122122

123-
@register.inclusion_tag("fundraising/includes/gold_corporate_members.html")
124-
def gold_corporate_members():
123+
@register.inclusion_tag("fundraising/includes/top_and_gold_corporate_members.html")
124+
def top_and_gold_corporate_members():
125125
members = CorporateMember.objects.by_membership_level()
126126

127-
return {"members": members["gold"]}
127+
return {"members": members["diamond"] + members["platinum"] + members["gold"]}

fundraising/tests/test_templatetags.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from ..templatetags.fundraising_extras import (
1818
display_django_heroes,
1919
donation_form_with_heart,
20-
gold_corporate_members,
20+
top_and_gold_corporate_members,
2121
top_corporate_members,
2222
)
2323

@@ -170,12 +170,12 @@ def test_with_diamond_members_and_platinum_members(self):
170170
self.assertEqual(members, expected)
171171

172172

173-
class TestGoldCorporateMembers(TestCase):
173+
class TestTopAndGoldCorporateMembers(TestCase):
174174
past_date = date(2000, 1, 1)
175175
future_date = date(3000, 1, 1)
176176

177177
def test_with_no_gold_members(self):
178-
members = gold_corporate_members()["members"]
178+
members = top_and_gold_corporate_members()["members"]
179179
self.assertEqual(members, [])
180180

181181
def test_with_gold_members(self):
@@ -187,22 +187,26 @@ def test_with_gold_members(self):
187187
member_2.invoice_set.create(amount=8, expiration_date=self.future_date)
188188
member_3.invoice_set.create(amount=2, expiration_date=self.future_date)
189189

190-
members = gold_corporate_members()["members"]
190+
members = top_and_gold_corporate_members()["members"]
191191

192192
self.assertEqual(members, [member_2, member_1, member_3])
193193

194194
def test_with_gold_members_and_other_members(self):
195195
member_1 = CorporateMember.objects.create(membership_level=3)
196196
member_2 = CorporateMember.objects.create(membership_level=3)
197197
member_3 = CorporateMember.objects.create(membership_level=4)
198+
member_4 = CorporateMember.objects.create(membership_level=5)
199+
member_5 = CorporateMember.objects.create(membership_level=2)
198200

199201
member_1.invoice_set.create(amount=4, expiration_date=self.future_date)
200202
member_2.invoice_set.create(amount=8, expiration_date=self.future_date)
201203
member_3.invoice_set.create(amount=2, expiration_date=self.future_date)
204+
member_4.invoice_set.create(amount=2, expiration_date=self.future_date)
205+
member_5.invoice_set.create(amount=2, expiration_date=self.future_date)
202206

203-
members = gold_corporate_members()["members"]
204-
self.assertEqual(members, [member_2, member_1])
205-
self.assertNotIn(member_3, members)
207+
members = top_and_gold_corporate_members()["members"]
208+
self.assertEqual(members, [member_4, member_3, member_2, member_1])
209+
self.assertNotIn(member_5, members)
206210

207211
def test_with_gold_members_and_expired_invoice(self):
208212
member_1 = CorporateMember.objects.create(membership_level=3)
@@ -213,6 +217,6 @@ def test_with_gold_members_and_expired_invoice(self):
213217
member_2.invoice_set.create(amount=8, expiration_date=self.future_date)
214218
member_3.invoice_set.create(amount=2, expiration_date=self.past_date)
215219

216-
members = gold_corporate_members()["members"]
220+
members = top_and_gold_corporate_members()["members"]
217221
self.assertEqual(members, [member_2, member_1])
218222
self.assertNotIn(member_3, members)

0 commit comments

Comments
 (0)