Как вывести картинки в админке?
models.py
class Author(models.Model):
name = models.CharField(max_length=100)
date_of_birth = models.DateField(null=True, blank=True)
date_of_death = models.DateField('died', null=True, blank=True)
photo = models.ImageField(upload_to='photos/%y/%m/%d/', blank=True,verbose_name='Фотография')
def __str__(self):
return self.name
class Meta:
verbose_name = 'Автор'
verbose_name_plural = 'Авторы'
admin.py
class AuthorAdmin(admin.ModelAdmin):
list_display = ('photo', 'name',)
admin.site.register(Author, AuthorAdmin)