mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2025-01-01 10:02:01 +00:00
增加 admin 后台返回执行模板的 views 函数
This commit is contained in:
parent
21e977f409
commit
5eacb9f3d7
@ -1,3 +1,14 @@
|
||||
from django.shortcuts import render
|
||||
# coding=utf-8
|
||||
from django.conf import settings
|
||||
from django.http import HttpResponse, Http404
|
||||
|
||||
# Create your views here.
|
||||
from rest_framework.views import APIView
|
||||
|
||||
|
||||
class AdminTemplateView(APIView):
|
||||
def get(self, request, template_dir, template_name):
|
||||
path = settings.TEMPLATE_DIRS[0] + "/admin/" + template_dir + "/" + template_name + ".html"
|
||||
try:
|
||||
return HttpResponse(open(path).read(), content_type="text/html")
|
||||
except IOError:
|
||||
raise Http404
|
||||
|
Loading…
Reference in New Issue
Block a user