django“缩略图”不是有效的标签库:

发布于 2024-12-13 01:41:15 字数 7095 浏览 1 评论 0原文

我尝试过 django-filer 在单个文件字段中选择多个文件,只是我尝试了我的简单模型,但我面临着这个模板错误。我刚刚在 django admin 中使用了一个简单的模型。 请你帮助我好吗?

class MyFile(models.Model):
     title = models.CharField(max_length=200)
     cover = FilerFileField(null=True,blank=True)


Environment:


 Request Method: GET
 Request URL: http://127.0.0.1:8000/filer/folder/?t=id&pop=1

 Django Version: 1.3.1
 Python Version: 2.6.5
 Installed Applications:
 ['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'filer',
 'intelligence_centre']
  Installed Middleware:
  ('django.middleware.common.CommonMiddleware',
  'django.contrib.sessions.middleware.SessionMiddleware',
   'django.middleware.csrf.CsrfViewMiddleware',
   'django.contrib.auth.middleware.AuthenticationMiddleware',
   'django.contrib.messages.middleware.MessageMiddleware')


  Template error:
    In template /usr/local/lib/python2.6/dist-packages/filer/templates/admin/filer/tools/clipboard/clipboard.html, error at line 1
     'thumbnail' is not a valid tag library: Template library thumbnail not found, tried django.templatetags.thumbnail,django.contrib.admin.templatetags.thumbnail,filer.templatetags.thumbnail
      1 :  {% load thumbnail i18n %} 


  2 : {% for clipboard in user.filer_clipboards.all %}


  3 : <table style="width: 100%; border: 1px solid #DDDDDD;" class="clipboard">


  4 :     <thead>


  5 :         <tr><th colspan="3">{% trans "Clipboard" %}</th></tr>


  6 :     </thead>


  7 :     <tfoot>


  8 :         <tr>


  9 :             <td colspan="3">


         10 :                 <form action="{% url admin:filer-paste_clipboard_to_folder %}" method="post" style="display: inline;">


        11 :                     {% csrf_token %}

Traceback:
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/utils/decorators.py" in _wrapped_view
  93.                     response = view_func(request, *args, **kwargs)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  79.         response = view_func(request, *args, **kwargs)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/contrib/admin/sites.py" in inner
  197.             return view(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/filer/admin/folderadmin.py" in directory_listing
  241.             }, context_instance=RequestContext(request))
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/shortcuts/__init__.py" in render_to_response
  20.     return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader.py" in render_to_string
  181.         t = get_template(template_name)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader.py" in get_template
  157.     template, origin = find_template(template_name)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader.py" in find_template
  134.             source, display_name = loader(name, dirs)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader.py" in __call__
  42.         return self.load_template(template_name, template_dirs)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader.py" in load_template
  48.             template = get_template_from_string(source, origin, template_name)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader.py" in get_template_from_string
  168.     return Template(source, origin, name)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/base.py" in __init__
  108.         self.nodelist = compile_string(template_string, origin)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/base.py" in compile_string
  136.     return parser.parse()
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/base.py" in parse
  239.                     compiled_result = compile_func(self, token)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader_tags.py" in do_extends
  214.     nodelist = parser.parse()
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/base.py" in parse
  239.                     compiled_result = compile_func(self, token)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader_tags.py" in do_block
  192.     nodelist = parser.parse(('endblock', 'endblock %s' % block_name))
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/base.py" in parse
  239.                     compiled_result = compile_func(self, token)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader_tags.py" in do_include
  261.                                    isolated_context=isolated_context)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader_tags.py" in __init__
  149.             t = get_template(template_path)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader.py" in get_template
  157.     template, origin = find_template(template_name)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader.py" in find_template
  134.             source, display_name = loader(name, dirs)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader.py" in __call__
  42.         return self.load_template(template_name, template_dirs)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader.py" in load_template
  48.             template = get_template_from_string(source, origin, template_name)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader.py" in get_template_from_string
  168.     return Template(source, origin, name)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/base.py" in __init__
  108.         self.nodelist = compile_string(template_string, origin)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/base.py" in compile_string
  136.     return parser.parse()
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/base.py" in parse
  239.                     compiled_result = compile_func(self, token)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/defaulttags.py" in load
  1054.                                           (taglib, e))

Exception Type: TemplateSyntaxError at /filer/folder/
Exception Value: 'thumbnail' is not a valid tag library: Template library thumbnail not found, tried django.templatetags.thumbnail,django.contrib.admin.templatetags.thumbnail,filer.templatetags.thumbnail
 

I have tried django-filer to select mulitple files in a single filefield just i tried for my simple model and i ma facing this template error. i have just used a simple model in django admin.
could you please help me?

class MyFile(models.Model):
     title = models.CharField(max_length=200)
     cover = FilerFileField(null=True,blank=True)


Environment:


 Request Method: GET
 Request URL: http://127.0.0.1:8000/filer/folder/?t=id&pop=1

 Django Version: 1.3.1
 Python Version: 2.6.5
 Installed Applications:
 ['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'filer',
 'intelligence_centre']
  Installed Middleware:
  ('django.middleware.common.CommonMiddleware',
  'django.contrib.sessions.middleware.SessionMiddleware',
   'django.middleware.csrf.CsrfViewMiddleware',
   'django.contrib.auth.middleware.AuthenticationMiddleware',
   'django.contrib.messages.middleware.MessageMiddleware')


  Template error:
    In template /usr/local/lib/python2.6/dist-packages/filer/templates/admin/filer/tools/clipboard/clipboard.html, error at line 1
     'thumbnail' is not a valid tag library: Template library thumbnail not found, tried django.templatetags.thumbnail,django.contrib.admin.templatetags.thumbnail,filer.templatetags.thumbnail
      1 :  {% load thumbnail i18n %} 


  2 : {% for clipboard in user.filer_clipboards.all %}


  3 : <table style="width: 100%; border: 1px solid #DDDDDD;" class="clipboard">


  4 :     <thead>


  5 :         <tr><th colspan="3">{% trans "Clipboard" %}</th></tr>


  6 :     </thead>


  7 :     <tfoot>


  8 :         <tr>


  9 :             <td colspan="3">


         10 :                 <form action="{% url admin:filer-paste_clipboard_to_folder %}" method="post" style="display: inline;">


        11 :                     {% csrf_token %}

Traceback:
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/utils/decorators.py" in _wrapped_view
  93.                     response = view_func(request, *args, **kwargs)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  79.         response = view_func(request, *args, **kwargs)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/contrib/admin/sites.py" in inner
  197.             return view(request, *args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/filer/admin/folderadmin.py" in directory_listing
  241.             }, context_instance=RequestContext(request))
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/shortcuts/__init__.py" in render_to_response
  20.     return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader.py" in render_to_string
  181.         t = get_template(template_name)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader.py" in get_template
  157.     template, origin = find_template(template_name)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader.py" in find_template
  134.             source, display_name = loader(name, dirs)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader.py" in __call__
  42.         return self.load_template(template_name, template_dirs)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader.py" in load_template
  48.             template = get_template_from_string(source, origin, template_name)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader.py" in get_template_from_string
  168.     return Template(source, origin, name)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/base.py" in __init__
  108.         self.nodelist = compile_string(template_string, origin)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/base.py" in compile_string
  136.     return parser.parse()
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/base.py" in parse
  239.                     compiled_result = compile_func(self, token)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader_tags.py" in do_extends
  214.     nodelist = parser.parse()
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/base.py" in parse
  239.                     compiled_result = compile_func(self, token)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader_tags.py" in do_block
  192.     nodelist = parser.parse(('endblock', 'endblock %s' % block_name))
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/base.py" in parse
  239.                     compiled_result = compile_func(self, token)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader_tags.py" in do_include
  261.                                    isolated_context=isolated_context)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader_tags.py" in __init__
  149.             t = get_template(template_path)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader.py" in get_template
  157.     template, origin = find_template(template_name)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader.py" in find_template
  134.             source, display_name = loader(name, dirs)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader.py" in __call__
  42.         return self.load_template(template_name, template_dirs)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader.py" in load_template
  48.             template = get_template_from_string(source, origin, template_name)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/loader.py" in get_template_from_string
  168.     return Template(source, origin, name)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/base.py" in __init__
  108.         self.nodelist = compile_string(template_string, origin)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/base.py" in compile_string
  136.     return parser.parse()
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/base.py" in parse
  239.                     compiled_result = compile_func(self, token)
File "/work/ws/intcen/venv/lib/python2.6/site-packages/django/template/defaulttags.py" in load
  1054.                                           (taglib, e))

Exception Type: TemplateSyntaxError at /filer/folder/
Exception Value: 'thumbnail' is not a valid tag library: Template library thumbnail not found, tried django.templatetags.thumbnail,django.contrib.admin.templatetags.thumbnail,filer.templatetags.thumbnail
 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

葬花如无物 2024-12-20 01:41:15

似乎您想使用“easy_thumbnails”https://github.com/SmileyChris/easy-thumbnails
这是 django-filer 的依赖项。

尝试在 settings.py 中添加应用程序:'easy_thumbnails'

查看变量:

THUMBNAIL_PROCESSORS = (
    'easy_thumbnails.processors.colorspace',
    'easy_thumbnails.processors.autocrop',
    #'easy_thumbnails.processors.scale_and_crop',
    'filer.thumbnail_processors.scale_and_crop_with_subject_location',
    'easy_thumbnails.processors.filters',
)

如安装段落中所述:https://github.com/stefanfoulis/django-filer

Seems like you want to use 'easy_thumbnails' https://github.com/SmileyChris/easy-thumbnails
which is a dependency of django-filer.

Try to add in your settings.py, the app : 'easy_thumbnails'

Take a look to the variable :

THUMBNAIL_PROCESSORS = (
    'easy_thumbnails.processors.colorspace',
    'easy_thumbnails.processors.autocrop',
    #'easy_thumbnails.processors.scale_and_crop',
    'filer.thumbnail_processors.scale_and_crop_with_subject_location',
    'easy_thumbnails.processors.filters',
)

as described in the installation paragraph here : https://github.com/stefanfoulis/django-filer

羁客 2024-12-20 01:41:15

您似乎忘记将 easy_thumbnails 添加到 INSTALLED_APPS 中。添加它,运行 syncdb 并查看它是否有效。

It looks like you forgot to add easy_thumbnails to your INSTALLED_APPS. Add it, run syncdb and see if it works then.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文