5👍
✅
You need to create another model (e.g. UploadFragment
) and bind it with a foreign key relation to your Upload
model.
class Upload(models.Model):
title = models.CharField(max_length = 30)
user = models.ForeignKey(User, on_delete=models.CASCADE)
class UploadFragment(models.Model):
file = models.FileField()
upload = models.ForeignKey(Upload, related_name="files", on_delete=models.CASCADE)
Source:stackexchange.com