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

@ -0,0 +1,19 @@
# Generated by Django 3.0.3 on 2020-02-20 12:48
from django.db import migrations, models
import django_etesync.models
class Migration(migrations.Migration):
dependencies = [
('django_etesync', '0009_auto_20200220_1220'),
]
operations = [
migrations.AlterField(
model_name='collectionitemchunk',
name='chunkFile',
field=models.FileField(max_length=150, unique=True, upload_to=django_etesync.models.chunk_directory_path),
),
]

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')