예제 #1
0
파일: status.py 프로젝트: land-pack/site
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)
예제 #2
0
파일: language.py 프로젝트: land-pack/site
 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
예제 #3
0
파일: forms.py 프로젝트: land-pack/site
 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()
예제 #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)
예제 #5
0
파일: forms.py 프로젝트: land-pack/site
 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()
예제 #6
0
파일: language.py 프로젝트: awaykened/site
 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
예제 #7
0
파일: language.py 프로젝트: awaykened/site
 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
예제 #8
0
파일: language.py 프로젝트: land-pack/site
 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