diff --git a/judge/views/organization.py b/judge/views/organization.py index db537212c..3b17337b5 100644 --- a/judge/views/organization.py +++ b/judge/views/organization.py @@ -567,18 +567,14 @@ def get_filter(self): return _filter & Q(organizations=self.organization) -class MonthlyCreditUsageOrganization(TitleMixin, PublicOrganizationMixin, ListView): - model = OrganizationMonthlyUsage +class MonthlyCreditUsageOrganization(LoginRequiredMixin, TitleMixin, AdminOrganizationMixin, ListView): template_name = 'organization/usage.html' - context_object_name = 'usages' - - def get_queryset(self): - return OrganizationMonthlyUsage.objects.filter(organization=self.organization)\ - .order_by('time').values('time', 'consumed_credit') def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['title'] = self.organization.name + context['usages'] = OrganizationMonthlyUsage.objects.filter(organization=self.organization)\ + .order_by('time').values('time', 'consumed_credit') usages = context['usages'] days = [usage['time'].isoformat() for usage in usages] + [_('Current month')] diff --git a/templates/organization/home.html b/templates/organization/home.html index 2ef8d1601..7d8c1e199 100644 --- a/templates/organization/home.html +++ b/templates/organization/home.html @@ -104,10 +104,10 @@

{{ _('Controls') }}

{% endif %} {% endif %}
-
- {{ _('Organization cost') }} -
{% if can_edit %} +
+ {{ _('Organization cost') }} +
{% if not organization.is_open %}