模型.py
class Issue(models.Model):
issueId = models.AutoField(primary_key=True)
title = models.CharField(max_length = 20)
year = models.IntegerField()
issueDate = models.DateField()
class Preview(models.Model):
issueId = models.ForeignKey(Issue);
previewPath = models.FileField(upload_to='./upload/magazine_sample')
管理员.py
class PreviewInline(object):
model = Preview
extra = 1
style = 'accordion'
max_num = 1
class IssueAdmin(object):
list_display = ('title',)
inlines = [PreviewInline]
admin.site.register(Issue, IssueAdmin)
删除问题模型时如何删除预览和上传的文件?任何人都可以帮助我吗?