diff --git a/src/super_archives/management/commands/update_keywords.py b/src/super_archives/management/commands/update_keywords.py new file mode 100644 index 0000000..f9a2a9c --- /dev/null +++ b/src/super_archives/management/commands/update_keywords.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +from django.core.management.base import BaseCommand, CommandError +from super_archives.models import Thread + + +class Command(BaseCommand): + help = "Update keywords used in tag cloud and related thread" + + def handle(self, *args, **kwargs): + for thread in Thread.objects.iterator(): + thread.update_keywords() diff --git a/src/super_archives/models.py b/src/super_archives/models.py index 221ba02..3aa8e6b 100644 --- a/src/super_archives/models.py +++ b/src/super_archives/models.py @@ -166,10 +166,6 @@ class Thread(models.Model, HitCounterModelMixin): return tuple() - def save(self, *args, **kwargs): - super(Thread, self).save(*args, **kwargs) - self.update_keywords() - def __unicode__(self): return '%s - %s (%s)' % (self.id, self.subject_token, -- libgit2 0.21.2