-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: Add gold members on pages foundation and community #2305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: Add gold members on pages foundation and community #2305
Conversation
|
Thank you for the PR! This looks great 👍 |
|
@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 |
c114138 to
fa7ecde
Compare
There was a problem hiding this 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...)
and
@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/ ?
|
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. |
fa7ecde to
c403b6a
Compare
sarahboyce
left a comment
There was a problem hiding this 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> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <h3>{{header}}</h3> | |
| <h3>{{ header }}</h3> |
(nit)
| members = top_corporate_members( | ||
| "diamond", "platinum", header="Diamond and Platinum members" | ||
| )["members"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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
| members = top_corporate_members( | ||
| "diamond", "platinum", header="Diamond and Platinum members" | ||
| )["members"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| members = top_corporate_members( | |
| "diamond", "platinum", header="Diamond and Platinum members" | |
| )["members"] | |
| members = top_corporate_members("diamond", "platinum")["members"] |
| members = top_corporate_members( | ||
| "diamond", "platinum", header="Diamond and Platinum members" | ||
| )["members"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| members = top_corporate_members( | |
| "diamond", "platinum", header="Diamond and Platinum members" | |
| )["members"] | |
| members = top_corporate_members("diamond", "platinum")["members"] |
| 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, | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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,
)There was a problem hiding this comment.
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
About this issue: #2302