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)
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
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()
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)
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()
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
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
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