Multi-platform: support multiple files per version #201
@ -43,10 +43,18 @@ def _delete_versionfiles_file(
|
||||
logger.info('Deleting File pk=%s of VersionFile pk=%s', file.pk, instance.pk)
|
||||
file.delete()
|
||||
|
||||
# this code is already quite convoluted
|
||||
# TODO? maybe find some way to have a predictable order of deletion
|
||||
try:
|
||||
if instance.version.files.count() == 0:
|
||||
# this was the last file, clean up the version
|
||||
logger.info('Deleting Version pk=%s because its last file was deleted', instance.version.pk)
|
||||
logger.info(
|
||||
'Deleting Version pk=%s because its last file was deleted',
|
||||
instance.version.pk,
|
||||
)
|
||||
instance.version.delete()
|
||||
except extensions.models.Version.DoesNotExist:
|
||||
pass
|
||||
|
||||
|
||||
@receiver(pre_save, sender=extensions.models.Extension)
|
||||
|
Loading…
Reference in New Issue
Block a user