2020-01-21 06:35:58 +00:00
|
|
|
from django.utils.translation import gettext_lazy
|
|
|
|
from django.views.generic import ListView
|
|
|
|
|
|
|
|
from judge.models import Language
|
|
|
|
from judge.utils.views import TitleMixin
|
|
|
|
|
|
|
|
|
|
|
|
class LanguageList(TitleMixin, ListView):
|
|
|
|
model = Language
|
2022-05-14 17:57:27 +00:00
|
|
|
context_object_name = "languages"
|
|
|
|
template_name = "status/language-list.html"
|
|
|
|
title = gettext_lazy("Runtimes")
|
2020-01-21 06:35:58 +00:00
|
|
|
|
|
|
|
def get_queryset(self):
|
2022-05-14 17:57:27 +00:00
|
|
|
queryset = super().get_queryset().prefetch_related("runtimeversion_set")
|
2020-01-21 06:35:58 +00:00
|
|
|
if not self.request.user.is_superuser and not self.request.user.is_staff:
|
|
|
|
queryset = queryset.filter(judges__online=True).distinct()
|
|
|
|
return queryset
|