I'm having trouble with Django 1.3 using django-grappeli and sorl-thumbnail. I have a project that uses this code from the official sorl-thumbnails docs:
# myapp/admin.py
from django.contrib import admin
from myapp.models import MyModel
from sorl.thumbnail.admin import AdminImageMixin
class MyModelAdmin(AdminImageMixin, admin.ModelAdmin):
pass
This project works well with the debug server and a nice little thumbnail appears in the change form of the admin.
However, in another project, i'm serving my project through WSGI and I have 3 separate domains:
www.example.com
media.example.com (that's serving user uploaded files)
static.example.com (that's serving static files)
However, in this project, the AdminImageMixin works fine except no thumbnail is available in the changeform for a model:
- It uploads the picture in the correct place
- It puts the correct text in the database field (uploads/ + picture_name.jpg) (i verified this with phpmyadmin)
- It doesn't show any thumbnail in the form besides the browse button (like i'm used to)
Here is some sample code:
# models.py
class Category(models.Model):
name = models.CharField(max_length=200, verbose_name='name', help_text='Name of category')
description = models.TextField(verbose_name='Description', help_text='You can use Textile')
icon = ImageField(upload_to='uploads/', blank=True, null=True)
# admin.py
class CategoryAdmin(AdminImageMixin, admin.ModelAdmin):
pass
admin.site.register(Category, CategoryAdmin)
# settings.py
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'grappelli',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
'django_evolution',
'django_extensions',
'sorl.thumbnail',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
Any ideea what I'm doing wrong?
Thank you in advance.