From 0c8bc0465939235737a71902e78ec8c9a222f040 Mon Sep 17 00:00:00 2001 From: Mamatha1718 Date: Tue, 3 Dec 2024 14:03:05 +0530 Subject: [PATCH 1/4] Clarify 000/year in help text --- fundraising/forms.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/fundraising/forms.py b/fundraising/forms.py index 3127866ee..dc1768952 100644 --- a/fundraising/forms.py +++ b/fundraising/forms.py @@ -46,25 +46,11 @@ class DjangoHeroForm(forms.ModelForm): logo = forms.FileField( required=False, help_text=_( - "If you've donated at least US $%d, you can submit your logo and " + "If you've donated at least US $%d in a calendar year, you can submit your logo and " "we will display it, too." ) % LEADERSHIP_LEVEL_AMOUNT, ) - is_visible = forms.BooleanField( - required=False, - label=_( - "Yes, display my name, URL, and logo on this site. " - "It'll be displayed shortly after we verify it." - ), - ) - is_subscribed = forms.BooleanField( - required=False, - label=_( - "Yes, the Django Software Foundation can inform me about " - "future fundraising campaigns by email." - ), - ) class Meta: model = DjangoHero From c498116b589c464c105a40256d48db3428b9108b Mon Sep 17 00:00:00 2001 From: Mamatha1718 Date: Sat, 28 Dec 2024 13:43:33 +0530 Subject: [PATCH 2/4] Simplify header text in community pages #1563 --- aggregator/context_processors.py | 2 +- djangoproject/templates/base_community.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aggregator/context_processors.py b/aggregator/context_processors.py index 36b1bcfbe..2bc2de6d0 100644 --- a/aggregator/context_processors.py +++ b/aggregator/context_processors.py @@ -12,5 +12,5 @@ def community_stats(request): Context processor to calculate Django's age for the community pages. """ # Django 3.2 introduces depth kwarg. Set timesince(..., depth=1) then. - stats = {"age": timesince(DJANGO_DOB)} + stats = {"age": timesince(DJANGO_DOB, depth=1)} return {"community_stats": stats} diff --git a/djangoproject/templates/base_community.html b/djangoproject/templates/base_community.html index 294bc92eb..91663ef87 100644 --- a/djangoproject/templates/base_community.html +++ b/djangoproject/templates/base_community.html @@ -2,7 +2,7 @@ {% load fundraising_extras i18n %} {% block og_title %}{% translate "Django Community" %}{% endblock %} -{% block og_description %}{% translate "Building the Django Community. Come join us!" %}{% endblock %} +{% block og_description %}{% translate "Building the Django Community for {{ community_stats.age }} Come join us!" %}{% endblock %} {% block layout_class %}sidebar-right{% endblock %} {% block title %}{% translate "Django Community" %}{% endblock %} From 6b41ad64469699c772a127dde5c96d0e0db82d60 Mon Sep 17 00:00:00 2001 From: Mamatha1718 Date: Mon, 30 Dec 2024 18:00:00 +0530 Subject: [PATCH 3/4] Investigate and fix N+1 query issue #1806 --- dashboard/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dashboard/views.py b/dashboard/views.py index 0c6238793..aada1c1e3 100644 --- a/dashboard/views.py +++ b/dashboard/views.py @@ -19,12 +19,13 @@ def index(request): if data is None: metrics = [] for MC in Metric.__subclasses__(): - metrics.extend(MC.objects.filter(show_on_dashboard=True)) + metrics.extend(MC.objects.filter(show_on_dashboard=True).prefetch_related("data")) metrics = sorted(metrics, key=operator.attrgetter("display_position")) data = [] for metric in metrics: - data.append({"metric": metric, "latest": metric.data.latest()}) + latest_data = metric.data.latest() + data.append({"metric": metric, "latest": latest_data}) cache.set(key, data, 60 * 60, version=generation) return render(request, "dashboard/index.html", {"data": data}) From e122f1b962ab21001b77cd4462b1ceb065506baa Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 30 Dec 2024 12:30:43 +0000 Subject: [PATCH 4/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- dashboard/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dashboard/views.py b/dashboard/views.py index aada1c1e3..06dc69600 100644 --- a/dashboard/views.py +++ b/dashboard/views.py @@ -19,7 +19,9 @@ def index(request): if data is None: metrics = [] for MC in Metric.__subclasses__(): - metrics.extend(MC.objects.filter(show_on_dashboard=True).prefetch_related("data")) + metrics.extend( + MC.objects.filter(show_on_dashboard=True).prefetch_related("data") + ) metrics = sorted(metrics, key=operator.attrgetter("display_position")) data = []