diff --git a/boards/management/commands/invalidate_sync_cache.py b/boards/management/commands/invalidate_sync_cache.py --- a/boards/management/commands/invalidate_sync_cache.py +++ b/boards/management/commands/invalidate_sync_cache.py @@ -12,9 +12,11 @@ class Command(BaseCommand): @transaction.atomic def handle(self, *args, **options): count = 0 - for global_id in GlobalId.objects.all(): + for global_id in GlobalId.objects.exclude(content__isnull=True).exclude( + content=''): if global_id.is_local() and global_id.content is not None: global_id.content = None global_id.save() + global_id.signature_set.all().delete() count += 1 print('Invalidated {} caches.'.format(count))