测试gitnore

This commit is contained in:
ladeng07
2022-05-06 15:45:57 +08:00
parent 12f390949b
commit 51552904f9
2347 changed files with 120102 additions and 53549 deletions
@@ -7,6 +7,8 @@ from django.template.loader import get_template
from django.utils.functional import cached_property
from django.utils.module_loading import import_string
ROOT = Path(__file__).parent
@functools.lru_cache()
def get_default_renderer():
@@ -16,7 +18,7 @@ def get_default_renderer():
class BaseRenderer:
def get_template(self, template_name):
raise NotImplementedError("subclasses must implement get_template()")
raise NotImplementedError('subclasses must implement get_template()')
def render(self, template_name, context, request=None):
template = self.get_template(template_name)
@@ -29,14 +31,12 @@ class EngineMixin:
@cached_property
def engine(self):
return self.backend(
{
"APP_DIRS": True,
"DIRS": [Path(__file__).parent / self.backend.app_dirname],
"NAME": "djangoforms",
"OPTIONS": {},
}
)
return self.backend({
'APP_DIRS': True,
'DIRS': [ROOT / self.backend.app_dirname],
'NAME': 'djangoforms',
'OPTIONS': {},
})
class DjangoTemplates(EngineMixin, BaseRenderer):
@@ -44,7 +44,6 @@ class DjangoTemplates(EngineMixin, BaseRenderer):
Load Django templates from the built-in widget templates in
django/forms/templates and from apps' 'templates' directory.
"""
backend = DjangoTemplates
@@ -53,11 +52,9 @@ class Jinja2(EngineMixin, BaseRenderer):
Load Jinja2 templates from the built-in widget templates in
django/forms/jinja2 and from apps' 'jinja2' directory.
"""
@cached_property
def backend(self):
from django.template.backends.jinja2 import Jinja2
return Jinja2
@@ -66,6 +63,5 @@ class TemplatesSetting(BaseRenderer):
Load templates using template.loader.get_template() which is configured
based on settings.TEMPLATES.
"""
def get_template(self, template_name):
return get_template(template_name)