diff --git a/vrobbler/apps/videos/management/commands/merge_duplicate_series_by_name.py b/vrobbler/apps/videos/management/commands/merge_duplicate_series_by_name.py index 202d9bc..1e792ca 100644 --- a/vrobbler/apps/videos/management/commands/merge_duplicate_series_by_name.py +++ b/vrobbler/apps/videos/management/commands/merge_duplicate_series_by_name.py @@ -1,5 +1,5 @@ from django.core.management.base import BaseCommand -from django.db import models +from django.db import connection, models class Command(BaseCommand): @@ -88,7 +88,10 @@ class Command(BaseCommand): ) total_moved += video_count - dup_series.delete() + with connection.cursor() as cursor: + cursor.execute( + "DELETE FROM videos_series WHERE id = %s", [dup_series.id] + ) self.stdout.write(f" Deleted series id={dup_series.id}") self.stdout.write( diff --git a/vrobbler/apps/videos/management/commands/merge_duplicate_videos.py b/vrobbler/apps/videos/management/commands/merge_duplicate_videos.py index f30684d..84c12b2 100644 --- a/vrobbler/apps/videos/management/commands/merge_duplicate_videos.py +++ b/vrobbler/apps/videos/management/commands/merge_duplicate_videos.py @@ -1,5 +1,5 @@ from django.core.management.base import BaseCommand -from django.db import models +from django.db import connection, models class Command(BaseCommand): @@ -80,7 +80,10 @@ class Command(BaseCommand): f" Moved {scrobble_count} scrobbles from id={dup_video.id} to id={keeper.id}" ) - dup_video.delete() + with connection.cursor() as cursor: + cursor.execute( + "DELETE FROM videos_video WHERE id = %s", [dup_video.id] + ) self.stdout.write(f" Deleted video id={dup_video.id}") self.stdout.write(self.style.SUCCESS("\nDone!"))