Skip to content

Conversation

@antoinehashbang
Copy link
Contributor

About this issue: #2302

  • Add a templatetag "gold_corporate_members", similar to the one used in the /download/ page
  • In files "base_community.html" and "base_foundation.html", add a block "content-related-extra" in block "content-related"
  • In files "foundation.html" and "index.html" (template for community page), use this block to call templatetag "gold_corporate_members"
  • Add few tests for this new templatetags
  • update test "test_community_index_number_of_queries" because we have increase the number of queries on this page

@sarahboyce
Copy link
Contributor

Thank you for the PR! This looks great 👍
There's an update on the issue that we should have Gold+ sponsors (#2302 (comment)), do you mind updating?

@SaptakS
Copy link
Contributor

SaptakS commented Nov 18, 2025

@antoinehashbang did you get a chance to make the updates as mentioned in the comment above?

@antoinehashbang
Copy link
Contributor Author

@antoinehashbang did you get a chance to make the updates as mentioned in the comment above?

Hello, not yet, but It should be done until end of week

@antoinehashbang antoinehashbang force-pushed the feat/2302_show_gold_members branch from c114138 to fa7ecde Compare November 27, 2025 09:21
Copy link
Contributor

@sarahboyce sarahboyce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the updates!
In case @cholmes5 wants to take a look this would roughly look like (ignore the random test data...)

Screenshot from 2025-11-27 12-55-00

and

Screenshot from 2025-11-27 12-55-26

@antoinehashbang I think you've missed the following comment about the News page (#2302 (comment))

Also @cholmes5 when you say About pages, do you mean only https://www.djangoproject.com/foundation/ or also other pages like https://www.djangoproject.com/foundation/faq/ ?

@alexgmin
Copy link
Contributor

alexgmin commented Dec 5, 2025

I talked with @cholmes5 in slack and she is ok with showing the sponsors at the top in all pages in the community and foundation sections, the way it is right now on the screenshots. Once @sarahboyce comment is addressed, this should be ready to merge.

@antoinehashbang Will you be able to address @sarahboyce comment soon? If now, is it a problem if a maintainer addresses it? It's only to finally get it done and live, not to remove any credit from you.

@antoinehashbang antoinehashbang force-pushed the feat/2302_show_gold_members branch from fa7ecde to c403b6a Compare December 5, 2025 16:33
Copy link
Contributor

@sarahboyce sarahboyce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @antoinehashbang
I have added a few nit-picky suggestions 👍 but looks good to me

{% if members %}
<div class="corporate-members">
<h3>Diamond and Platinum Members</h3>
<h3>{{header}}</h3>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<h3>{{header}}</h3>
<h3>{{ header }}</h3>

(nit)

Comment on lines +133 to +135
members = top_corporate_members(
"diamond", "platinum", header="Diamond and Platinum members"
)["members"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
members = top_corporate_members(
"diamond", "platinum", header="Diamond and Platinum members"
)["members"]
members = top_corporate_members("diamond", "platinum")["members"]

The header doesn't matter here

Comment on lines +148 to +150
members = top_corporate_members(
"diamond", "platinum", header="Diamond and Platinum members"
)["members"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
members = top_corporate_members(
"diamond", "platinum", header="Diamond and Platinum members"
)["members"]
members = top_corporate_members("diamond", "platinum")["members"]

Comment on lines +171 to +173
members = top_corporate_members(
"diamond", "platinum", header="Diamond and Platinum members"
)["members"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
members = top_corporate_members(
"diamond", "platinum", header="Diamond and Platinum members"
)["members"]
members = top_corporate_members("diamond", "platinum")["members"]

Comment on lines +180 to +215
member_1 = CorporateMember.objects.create(membership_level=4)
member_2 = CorporateMember.objects.create(membership_level=4)
member_3 = CorporateMember.objects.create(membership_level=4)

member_4 = CorporateMember.objects.create(membership_level=5)
member_5 = CorporateMember.objects.create(membership_level=5)
member_6 = CorporateMember.objects.create(membership_level=5)

member_7 = CorporateMember.objects.create(membership_level=3)
member_8 = CorporateMember.objects.create(membership_level=3)

member_1.invoice_set.create(amount=4, expiration_date=self.future_date)
member_2.invoice_set.create(amount=8, expiration_date=self.future_date)
member_3.invoice_set.create(amount=2, expiration_date=self.future_date)

member_4.invoice_set.create(amount=4, expiration_date=self.future_date)
member_5.invoice_set.create(amount=8, expiration_date=self.future_date)
member_6.invoice_set.create(amount=2, expiration_date=self.future_date)

member_7.invoice_set.create(amount=8, expiration_date=self.future_date)
member_8.invoice_set.create(amount=2, expiration_date=self.future_date)

members = top_corporate_members(
"diamond", "platinum", "gold", header="Diamond, Platinum and Gold members"
)["members"]

expected = [
member_5,
member_4,
member_6,
member_2,
member_1,
member_3,
member_7,
member_8,
]
Copy link
Contributor

@sarahboyce sarahboyce Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
member_1 = CorporateMember.objects.create(membership_level=4)
member_2 = CorporateMember.objects.create(membership_level=4)
member_3 = CorporateMember.objects.create(membership_level=4)
member_4 = CorporateMember.objects.create(membership_level=5)
member_5 = CorporateMember.objects.create(membership_level=5)
member_6 = CorporateMember.objects.create(membership_level=5)
member_7 = CorporateMember.objects.create(membership_level=3)
member_8 = CorporateMember.objects.create(membership_level=3)
member_1.invoice_set.create(amount=4, expiration_date=self.future_date)
member_2.invoice_set.create(amount=8, expiration_date=self.future_date)
member_3.invoice_set.create(amount=2, expiration_date=self.future_date)
member_4.invoice_set.create(amount=4, expiration_date=self.future_date)
member_5.invoice_set.create(amount=8, expiration_date=self.future_date)
member_6.invoice_set.create(amount=2, expiration_date=self.future_date)
member_7.invoice_set.create(amount=8, expiration_date=self.future_date)
member_8.invoice_set.create(amount=2, expiration_date=self.future_date)
members = top_corporate_members(
"diamond", "platinum", "gold", header="Diamond, Platinum and Gold members"
)["members"]
expected = [
member_5,
member_4,
member_6,
member_2,
member_1,
member_3,
member_7,
member_8,
]
membership_levels = (
[PLATINUM_MEMBERSHIP] * 3 + [DIAMOND_MEMBERSHIP] * 3 + [GOLD_MEMBERSHIP] * 2
)
objs = CorporateMember.objects.bulk_create(
[CorporateMember(membership_level=ml) for ml in membership_levels]
)
# Add future invoices of varying amounts to set the order of sponsors.
# Platinum members.
objs[0].invoice_set.create(amount=4, expiration_date=self.future_date)
objs[1].invoice_set.create(amount=8, expiration_date=self.future_date)
objs[2].invoice_set.create(amount=2, expiration_date=self.future_date)
# Diamond members.
objs[3].invoice_set.create(amount=4, expiration_date=self.future_date)
objs[4].invoice_set.create(amount=8, expiration_date=self.future_date)
objs[5].invoice_set.create(amount=2, expiration_date=self.future_date)
# Gold members.
objs[6].invoice_set.create(amount=8, expiration_date=self.future_date)
objs[7].invoice_set.create(amount=2, expiration_date=self.future_date)
members = top_corporate_members("diamond", "platinum", "gold")["members"]
expected = [
objs[4], # Diamond, future invoice 8.
objs[3], # Diamond, future invoice 4.
objs[5], # Diamond, future invoice 2.
objs[1], # Platinum, future invoice 8.
objs[0], # Platinum, future invoice 4.
objs[2], # Platinum, future invoice 2.
objs[6], # Gold, future invoice 8.
objs[7], # Gold, future invoice 2.
]

We can use a bulk create here
We can also use the constants to make it clearer what membership levels are being created, these will need to be imported

from members.models import (
    CorporateMember,
    GOLD_MEMBERSHIP,
    PLATINUM_MEMBERSHIP,
    DIAMOND_MEMBERSHIP,
)

Copy link
Contributor

@sarahboyce sarahboyce Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have just seen that the current test is aligned to the format of existing tests, in which case, this suggestion makes less sense 🤔 maybe ignore it (except the update to members = top_corporate_members("diamond", "platinum", "gold")["members"])
We might want to refactor the tests in future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants