<commit_before>from django.shortcuts import render

# Create your views here.<commit_msg>增加 admin 后台返回执行模板的 views 函数<commit_after># coding=utf-8
from django.conf import settings
from django.http import HttpResponse, Http404

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
{'fraction_non_alphanumeric': 0.09698996655518395, 'fraction_numerical': 0.013377926421404682, 'mean_word_length': 3.8306451612903225, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '600957', 'n_tokens_mistral': 184, 'n_tokens_neox': 182, 'n_words': 47}