sshwsfc / xadmin

Drop-in replacement of Django admin comes with lots of goodies, fully extensible with plugin support, pretty UI based on Twitter Bootstrap.
http://www.xadmin.io
BSD 3-Clause "New" or "Revised" License
4.76k stars 1.41k forks source link

Incompatible with jinja2! #423

Open nocmt opened 7 years ago

nocmt commented 7 years ago

When I use "jinja2" instead of the default template system, I try:

import xadmin

urlpatterns = [
    url(r'^xadmin/', xadmin.site.urls),
]

I got the following error:

  File "/media/nocmt/项目/总项目/xin/suly/suly/urls.py", line 9, in <module>
    url(r'^xadmin/', xadmin.site.urls),
  File "/media/nocmt/项目/总项目/xin/suly/extra_apps/xadmin/sites.py", line 339, in urls
    return self.get_urls(), self.name, self.app_name
  File "/media/nocmt/项目/总项目/xin/suly/extra_apps/xadmin/sites.py", line 296, in get_urls
    self.check_dependencies()
  File "/media/nocmt/项目/总项目/xin/suly/extra_apps/xadmin/sites.py", line 176, in check_dependencies
    default_template_engine = Engine.get_default()
  File "/opt/Venvs/test/lib/python3.6/site-packages/django/template/engine.py", line 83, in get_default
    "No DjangoTemplates backend is configured.")
django.core.exceptions.ImproperlyConfigured: No DjangoTemplates backend is configured.

I'm using the latest development version, this 1.11, and that's a problem.

cupen commented 7 years ago

The var settings.TEMPLATES is a list, and you can configure multiple template backends. I guess you doesn't want to rewrite xadmin's template code with jinja2, is it? If so, you would to add a new template backend working together with the old one rather then instead of it.

Read The Friendly Document, plz. https://docs.djangoproject.com/en/1.11/topics/templates/

nocmt commented 7 years ago

OK, I see. I'll still use the default template.