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

pull/56/head
Tom Hacohen 4 years ago
parent 0c44f738fd
commit d57ed03417

@ -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),
),
]

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

Loading…
Cancel
Save