From 5eacb9f3d74651cea6f8e6d57dcc246bd5478c11 Mon Sep 17 00:00:00 2001 From: virusdefender <1670873886@qq.com> Date: Wed, 5 Aug 2015 19:47:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20admin=20=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E6=89=A7=E8=A1=8C=E6=A8=A1=E6=9D=BF=E7=9A=84?= =?UTF-8?q?=20views=20=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/views.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/admin/views.py b/admin/views.py index 91ea44a..78762c0 100644 --- a/admin/views.py +++ b/admin/views.py @@ -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