Skip to content

Commit 3247d78

Browse files
Make the indexing configurable
If the index subclass defines a get_queryset method we call it
1 parent 6533665 commit 3247d78

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/models.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,13 @@ def reindex_all(self, batch_size=1000):
212212
result = None
213213
counts = 0
214214
batch = []
215-
for instance in self.model.objects.all():
215+
216+
if getattr(self, 'get_queryset', None):
217+
qs = self.get_queryset()
218+
else:
219+
qs = self.model.objects.all()
220+
221+
for instance in qs:
216222
if self.should_index:
217223
attr = getattr(instance, self.should_index)
218224
if not attr():

0 commit comments

Comments
 (0)