简体   繁体   English

如何在相同的Django项目中同时使用简单缩略图和sorl-thumbnail,但它们具有相同的模板标签?

[英]How can i use both easy thumbnails and sorl-thumbnail in the same django projects yet they have the same template tags?

I have this project where im using sorl-thumbnail to resize and crop my images on the template, in the same project i happen to use django CMS to manage my content, the problem is Django CMS needs ' easy-thumbnails for its filer app both apps use almost similar tags and i end up with this template syntax error placeholder', expected 'endblock'. Did you forget to register or load this tag? 我有一个项目,我使用sorl-thumbnail调整模板上的图像大小和裁剪图像,在同一项目中,我碰巧使用django CMS来管理我的内容,问题是Django CMS的filer应用都需要' easy-thumbnails应用程序使用几乎相似的标记,并且我最终遇到此模板语法错误placeholder', expected 'endblock'. Did you forget to register or load this tag? placeholder', expected 'endblock'. Did you forget to register or load this tag? when i try to use Django CMS {% placeholder 'mycontent' %} on my template. 当我尝试在模板上使用Django CMS {% placeholder 'mycontent' %}时。

looks like others have had this issue, and it remains unsolved: Django template tags with same name 看起来其他人都遇到了这个问题,并且仍然没有解决: 相同名称的Django模板标签

If it's feasible to give up the use of one option or another, you could try loading one tag library before the other. 如果可以放弃使用一个选项或另一个选项,则可以尝试先加载一个标签库。

If that's not feasible, you still may have to try loading one tag library before the other, but make another tag library which imports the abandoned library, and makes another, uniquely-named tag which explicitly calls the inaccessible tag 如果这样做不可行,您仍然可能必须先尝试加载一个标签库,然后再制作另一个标签库,以导入废弃的库,并制作另一个唯一命名的标签,该标签明确调用不可访问的标签

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM