Make sure we don't upload the same file twice.

This commit is contained in:
Tom Hacohen
2020-02-20 14:48:19 +02:00
parent 0c44f738fd
commit d57ed03417
2 changed files with 20 additions and 1 deletions

View File

@@ -65,7 +65,7 @@ class CollectionItemChunk(models.Model):
max_length=44, validators=[UidValidator])
item = models.ForeignKey(CollectionItem, related_name='chunks', on_delete=models.CASCADE)
order = models.CharField(max_length=100, blank=False, null=False)
chunkFile = models.FileField(upload_to=chunk_directory_path, max_length=150)
chunkFile = models.FileField(upload_to=chunk_directory_path, max_length=150, unique=True)
class Meta:
unique_together = ('item', 'order')