sorl.thumbnail没有在管理面板中显示img

时间:2017-02-06 14:39:56

标签: django sorl-thumbnail

我使用的是django 1.10和最后一个sorl.thumbnail 这是我的 models.py

from sorl.thumbnail import ImageField
class StockImage(models.Model):
    image = models.ImageField(upload_to='stock', blank=True, null=True,
                              verbose_name=_('Image'))

这里是 admin.py

from sorl.thumbnail.admin import AdminImageMixin
class StockImageInline(AdminImageMixin, admin.StackedInline):
    model = StockImage
    extra = 1    

@admin.register(Stock)
class StockAdmin(TranslationAdmin):
    group_fieldsets = True
    list_display = ('title', 'city', 'start_date', 'finish_date', 'unlimited', 'publish')
    inlines = [
        StockImageInline,
    ]

0 个答案:

没有答案