File tree 1 file changed +8
-6
lines changed
readthedocs/search/management/commands 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -72,11 +72,6 @@ def _run_reindex_tasks(self, models):
72
72
.format (app_label , model_name , len (instance_ids )))
73
73
log .info (message )
74
74
75
- @staticmethod
76
- def _get_models (args ):
77
- for model_name in args :
78
- yield apps .get_model (model_name )
79
-
80
75
def add_arguments (self , parser ):
81
76
parser .add_argument (
82
77
'--models' ,
@@ -88,8 +83,15 @@ def add_arguments(self, parser):
88
83
)
89
84
90
85
def handle (self , * args , ** options ):
86
+ """
87
+ Index models into Elasticsearch index asynchronously using celery.
88
+
89
+ You can specify model to get indexed by passing
90
+ `--model <app_label>.<model_name>` parameter.
91
+ Otherwise, it will reindex all the models
92
+ """
91
93
models = None
92
94
if options ['models' ]:
93
- models = self . _get_models ( options ['models' ])
95
+ models = [ apps . get_model ( model_name ) for model_name in options ['models' ]]
94
96
95
97
self ._run_reindex_tasks (models = models )
You can’t perform that action at this time.
0 commit comments