Giter Site home page Giter Site logo

Comments (5)

creimers avatar creimers commented on August 19, 2024 1

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.

06GitHub avatar 06GitHub commented on August 19, 2024

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 :

  1. 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 !
    [...]

  2. 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 !
    [...]

  3. 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.

06GitHub avatar 06GitHub commented on August 19, 2024

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.

arigbs avatar arigbs commented on August 19, 2024

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.

martinkrung avatar martinkrung commented on August 19, 2024

don't think this is still relevant in 2020, thus closed

from django-smart-load-tag.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.