Skip to content

Commit

Permalink
Clear out collections (except root collection) when running exodus
Browse files Browse the repository at this point in the history
  • Loading branch information
rlskoeser committed Dec 22, 2020
1 parent 4328ebc commit 71e357c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cdhweb/pages/management/commands/exodus.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,11 @@ def image_exodus(self):
# mezzanine/filebrowser_safe doesn't seem to have useful objects
# or track metadata, so just import from the filesystem

# delete all images prior to run (clear out past migration attempts)
# delete all images and collections prior to run
# (clear out past migration attempts)
Image.objects.all().delete()
Collection.objects.exclude(pk=get_root_collection_id()).delete()

# also delete any wagtail image files, since they are not deleted
# by removing the objects
shutil.rmtree('%s/images' % settings.MEDIA_ROOT, ignore_errors=True)
Expand Down

0 comments on commit 71e357c

Please sign in to comment.