Using sorl thumbnail and easy thumbnails in the same template

At times you need to use both sorl.thumbnail and easy_thumbnails in the same template. Both of these apps define a thumbnail template tag from a thumbnail template module meaning that you will be able to use one or the other but not both. To get around this, you can install a great app called django-smart-load-tag

At times you need to use both sorl.thumbnail and easy_thumbnails in the same template. Both of these apps define a thumbnail template tag from a thumbnail template module meaning that you will be able to use one or the other but not both.

🚀 2017 Update: there are easier ways to get this working with more recent versions of Django. I've updated the post to first show the "newer" approach to working with template libraries that overlap then I've included the "older" approach I originally took.

New Approach

You can now use thelibraries dictionary from the default template backend in your settings.py to re-label your template libraries and avoid naming conflicts:

and within your template:

Of course, this means you can’t use both libraries’ {% thumbnail %} in the same template, but you can load both template libraries successfully in the same project.

Original Solution

At times you need to use both sorl.thumbnail and easy_thumbnails in the same template. Both of these apps define a thumbnail template tag from a thumbnail template module meaning that you will be able to use one or the other but not both. To get around this, you can install a great app called django-smart-load-tag which augments the default {% load %} tag and allows for much more flexible importing of template tags.

After installing django-smart-load-tag with pip install django-smart-load-tag add it to your INSTALLED_APPS:

open your template and do the following:

You now have both options!