diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-02-16 16:18:27 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-02-16 16:18:27 +0100 |
commit | e6d0247d597e64ecf1afb18c68386111164f900b (patch) | |
tree | 7e03a08a60e2943d50f89069bd36246693391114 /ishtar_common/management/commands/update_search_vectors.py | |
parent | ee13d186e850749c62e7952c8524704a08317733 (diff) | |
download | Ishtar-e6d0247d597e64ecf1afb18c68386111164f900b.tar.bz2 Ishtar-e6d0247d597e64ecf1afb18c68386111164f900b.zip |
update_search_vector: can specify a model to update
Diffstat (limited to 'ishtar_common/management/commands/update_search_vectors.py')
-rw-r--r-- | ishtar_common/management/commands/update_search_vectors.py | 7 |
1 files changed, 7 insertions, 0 deletions
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 |