我正在创建一个集体翻译的项目,所以我得到了带有图像的原始文本。基本思想是将文本拆分成块,块可以是不同的类型:文本和图像(图像可以上传,alt和描述可以编辑......)
有概念验证
class Source(models.Model):
title = models.CharField(max_length=255, unique=True)
class SourceChunk(models.Model):
source = models.ForeignKey(Source)
class SourceTextChunk(models.Model):
chunk = models.ForeignKey(SourceChunk)
text = models.TextField()
class SourceImageChunk(models.Model):
chunk = models.ForeignKey(SourceChunk)
image = models.FileField()
alt = models.TextField()
title = models.TextField()
transcription = models.TextField()
class SourceAdmin(admin.ModelAdmin):
pass
我想创建表单,使用SourceAdmin(在管理页面中),将以这种方式显示:
... some other fields ...
text form
text form
text form
text form
image form
text form
text form
text form