Example #1
0
def get_judges(request):
    last_online_time = Judge.last_online_time()
    if request.user.is_superuser or request.user.is_staff:
        return True, list(chain(Judge.objects.filter(last_ping__gte=last_online_time),
                                Judge.objects.exclude(last_ping__gte=last_online_time)))
    else:
        return False, Judge.objects.filter(last_ping__gte=last_online_time)
Example #2
0
 def get_context_data(self, **kwargs):
     context = super(LanguageJudgesAjaxList,
                     self).get_context_data(**kwargs)
     context['judges'] = Judge.objects.filter(
         runtimes__key=self.lang,
         last_ping__gte=Judge.last_online_time()).order_by('load')
     return context
Example #3
0
 def __init__(self, *args, **kwargs):
     super(ProblemSubmitForm, self).__init__(*args, **kwargs)
     self.fields['problem'].empty_label = None
     self.fields['problem'].widget = forms.HiddenInput()
     self.fields['language'].empty_label = None
     self.fields['language'].label_from_instance = attrgetter('display_name')
     self.fields['language'].queryset = Language.objects.filter(
             judges__last_ping__gte=Judge.last_online_time()).distinct()
Example #4
0
def get_judges(request):
    last_online_time = Judge.last_online_time()
    if request.user.is_superuser or request.user.is_staff:
        return True, list(
            chain(Judge.objects.filter(last_ping__gte=last_online_time),
                  Judge.objects.exclude(last_ping__gte=last_online_time)))
    else:
        return False, Judge.objects.filter(last_ping__gte=last_online_time)
Example #5
0
 def __init__(self, *args, **kwargs):
     super(ProblemSubmitForm, self).__init__(*args, **kwargs)
     self.fields['problem'].empty_label = None
     self.fields['problem'].widget = forms.HiddenInput()
     self.fields['language'].empty_label = None
     self.fields['language'].label_from_instance = attrgetter(
         'display_name')
     self.fields['language'].queryset = Language.objects.filter(
         judges__last_ping__gte=Judge.last_online_time()).distinct()
Example #6
0
 def get_context_data(self, **kwargs):
     context = super(LanguageJudgesAjaxList, self).get_context_data(**kwargs)
     context["judges"] = Judge.objects.filter(
         runtimes__key=self.lang, last_ping__gte=Judge.last_online_time()
     ).order_by("load")
     return context
Example #7
0
 def get_context_data(self, **kwargs):
     context = super(LanguageDetail, self).get_context_data(**kwargs)
     context["judges"] = self.object.judges.filter(last_ping__gte=Judge.last_online_time()).order_by("load")
     return context
Example #8
0
 def get_context_data(self, **kwargs):
     context = super(LanguageDetail, self).get_context_data(**kwargs)
     context['judges'] = self.object.judges.filter(
         last_ping__gte=Judge.last_online_time()).order_by('load')
     return context