modify resolver link
This commit is contained in:
parent
cf431b8fab
commit
551c9c3503
3 changed files with 17 additions and 13 deletions
|
@ -1099,7 +1099,7 @@ urlpatterns = [
|
|||
]
|
||||
),
|
||||
),
|
||||
url(r"^resolver/(?P<contest>\w+)",resolver.resolver, name="resolver")
|
||||
url(r"^resolver/(?P<contest>\w+)",resolver.Resolver.as_view(), name="resolver")
|
||||
] + url_static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
# if hasattr(settings, "INTERNAL_IPS"):
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
from django.shortcuts import render
|
||||
from django.views.generic import TemplateView
|
||||
from django.utils.translation import gettext as _
|
||||
from django.http import HttpResponseForbidden
|
||||
|
||||
def resolver(request):
|
||||
class Resolver(TemplateView):
|
||||
title = _("Resolver")
|
||||
template_name = "resolver/resolver.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(Resolver, self).get_context_data(**kwargs)
|
||||
context["contest_json"] = "/static/contest.json"
|
||||
return context
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
if request.user.is_superuser:
|
||||
return render(
|
||||
request,
|
||||
"resolver/resolver.html",
|
||||
{
|
||||
"title": _("Resolver"),
|
||||
},
|
||||
)
|
||||
return super(Resolver, self).get(request, *args, **kwargs)
|
||||
return HttpResponseForbidden()
|
||||
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
var speed = 700;
|
||||
var autopress = false;
|
||||
$(document).ready(function() {
|
||||
$.getJSON('{{ static('contest.json') }}', function (data) {
|
||||
$.getJSON('{{ contest_json }}', function (data) {
|
||||
console.log("OK");
|
||||
var resolver = new Resolver(data.problem_sub, data.sub_frozen, data.problems, data.users);
|
||||
window.resolver = resolver;
|
||||
|
|
Loading…
Reference in a new issue