diff --git a/boards/management/commands/cleantags.py b/boards/management/commands/cleantags.py --- a/boards/management/commands/cleantags.py +++ b/boards/management/commands/cleantags.py @@ -13,7 +13,7 @@ class Command(BaseCommand): @transaction.atomic def handle(self, *args, **options): - empty = Tag.objects.annotate(num_threads=Count('thread'))\ + empty = Tag.objects.annotate(num_threads=Count('thread_tags'))\ .filter(num_threads=0).order_by('-required', 'name') print('Removing {} empty tags'.format(empty.count())) empty.delete()