Comments (5)
Why did the stackoverflow solution not work for you?
http://stackoverflow.com/questions/8174122/django-sorl-thumbnail-and-easy-thumbnail-in-same-project
from django-smart-load-tag.
I bumped into same problem : implementing a project in Django 1.8, with Python 3.4, with several 3rd parties applications, one of them relying on 'easy_thumbnails' and another one relying on 'sorl_thumbnail', which causes 'templatetag' clash when using {% load thumbnail %} .
I tried to implement those 2 solutions, without success :
http://stackoverflow.com/questions/8174122/django-sorl-thumbnail-and-easy-thumbnail-in-same-project
http://timmyomahony.com/blog/using-sorl-thumbnail-and-easy-thumbnails-same-template/
So I came up with a 3rd solution (workaround). This solution is described below, if it can be useful to someone, and if someone can find a better solution.
Solution principle :
-
Install easy_thumbnails as a local app in project
Do not use pip to install easy_thumbnails ('pip install easy_thumbnails') but download zip file from github https://github.com/SmileyChris/easy-thumbnails and unzip it in project directory :
myproject
......templates
......app1
...........templates
...................mytemplate.html
......app2
......easy_thumbnails <----- new !
...........templatetags <----- new !
...................thumbnail.py <----- new !
[...] -
Duplicate (copy) locally templatetags file 'thumbnail.py' to 'thumbnail_copy.py'
myproject
......templates
......app1
...........templates
...................mytemplate.html
......app2
......easy_thumbnails
...........templatetags
...................thumbnail.py
...................thumbnail_copy.py <----- new !
[...] -
Look for apps templates in project which use 'thumbnail.py', ie '{% load thumbnail %}'
a) if app is local to project (eg app1)
replace in template(s) (eg mytemplate.html)
{% load thumbnail %}
with
{% load thumbnail_copy %}
in order to remove templatetag clash for this template
Example :
myproject
......templates
......app1
...........templates
...................mytemplate.html <----- updated !
......app2
......easy_thumbnails
............templatetags
..................thumbnail.py
..................thumbnail_copy.py
[...]
b) if app is 'global' to environnement (ie, it has been installed with pip), such as 'globalapp_bootstrap3' (it is in python 3.4/... files structure), overload template locally, and replace in template(s)
{% load thumbnail %}
with
{% load thumbnail_copy %}
Example :
myproject
......templates
...........globalapp_bootstrap3 <----- new !
...................image.html <----- new(updated) !
......easy_thumbnails
......app1
...........templates
...................mytemplate.html
......app2
......easy_thumbnails
............templatetags
.............. ....thumbnail.py
.............. ....thumbnail_copy.py
[...]
By replacing {% load thumbnail %} with {% load thumbnail_copy %} in templates, the templatetag clash does not occur any longer and the same (correct) python code is executed, since templatetag file 'thumbnail_copy.py' is an exact copy of original templatetag file 'thumbnail.py'.
This is just a workaround, which worked for me, while waiting for a new version of excellent app django-smart-load-tag.
from django-smart-load-tag.
The stackoverflow solution generated an error when building project, I do not remember exactly which one, sorry (I did not log/record the error, but tried to find a workaround instead). Maybe I implemented wrongly the stackoverflow solution for Django 1.8 with Python 3.4 ?
from django-smart-load-tag.
Bumping this thread in the hope that someone would have an update. Got the same issue with django-smart-load-tag
from django-smart-load-tag.
don't think this is still relevant in 2020, thus closed
from django-smart-load-tag.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-smart-load-tag.