Sorl-thumbnail: sorl.thumbnail.ImageField not showing thumbnails with the AdminImageMixin

Created on 20 Jul 2015  ·  6Comments  ·  Source: jazzband/sorl-thumbnail

sorl-thumbnail==12.3
Django==1.8.3
Pillow==2.9.0

from sorl.thumbnail import ImageField as SorlImage
class Person(PublishedMixin):
    photo = SorlImage(upload_to='photos', blank=True, null=True)
...
from sorl.thumbnail.admin import AdminImageMixin as SorlImageAdmin
from reversion import VersionAdmin

class Admin(VersionAdmin):
    exclude = []

    class Media:
        css = {
            'all': ('css/admin_forms.css',)
        }

@register(Person)
class PersonAdmin(Admin, SorlImageAdmin):
...

I don't see any changes to the admin form compared to the default one, nothing in console output. Both with and without Grappelli activated.

Most helpful comment

try to use latest sorl.thumbnail version

pip install --pre --upgrade sorl-thumbnail

It has migrations

All 6 comments

The root cause of this problem for me was that there were no migrations available for sorl. I'm using python 3.5, django 1.9 and sorl 13.2 with Pillow.

I didn't have time to investigate why the migration was not being applied, but I believe that it may have to be something about django 1.9 or AppConfig...

Ugly temporary fix below...

$ python manage.py migrate thumbnail
CommandError: App 'thumbnail' does not have migrations.
$ python manage.py makemigrations thumbnail
Migrations for 'thumbnail':
  0001_initial.py:
    - Create model KVStore
$ python manage.py migrate
Operations to perform:
  Apply all migrations: <...>
Running migrations:
  Rendering model states... DONE
  Applying thumbnail.0001_initial... OK

bump...

try to use latest sorl.thumbnail version

pip install --pre --upgrade sorl-thumbnail

It has migrations

Worked great, thanks.

It's works! Thank you.

Thanks for this trick !

Was this page helpful?
0 / 5 - 0 ratings