diff --git a/dashboard/views.py b/dashboard/views.py index 0c6238793..06dc69600 100644 --- a/dashboard/views.py +++ b/dashboard/views.py @@ -19,12 +19,15 @@ 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}) 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