From e1532379202ec3f72792b07b70666ab082314193 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 16 Feb 2018 16:18:27 +0100 Subject: update_search_vector: can specify a model to update --- ishtar_common/management/commands/update_search_vectors.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ishtar_common/management/commands') diff --git a/ishtar_common/management/commands/update_search_vectors.py b/ishtar_common/management/commands/update_search_vectors.py index c158a2588..9fa93277c 100644 --- a/ishtar_common/management/commands/update_search_vectors.py +++ b/ishtar_common/management/commands/update_search_vectors.py @@ -11,8 +11,15 @@ class Command(BaseCommand): help = "./manage.py update_search_vectors\n\n"\ "Update full texte search vectors." + def add_arguments(self, parser): + parser.add_argument( + '--model', type=str, default='', dest='model', + help='Specific model to update') + def handle(self, *args, **options): for model in django.apps.apps.get_models(): + if options['model'] and model.__name__ != options['model']: + continue if hasattr(model, "update_search_vector") and \ (getattr(model, "BASE_SEARCH_VECTORS", None) or getattr(model, "INT_SEARCH_VECTORS", None) or -- cgit v1.2.3