Added get_indexed_objects method to Indexed class

This gives developers control over the QuerySet used when the model is added to the indexed
This commit is contained in:
Karl Hobley 2014-06-24 14:27:40 +01:00
parent b78b648682
commit 9e1bd2d601
2 changed files with 5 additions and 1 deletions

View file

@ -118,6 +118,10 @@ class Indexed(object):
def get_filterable_search_fields(cls):
return filter(lambda field: isinstance(field, FilterField), cls.get_search_fields())
@classmethod
def get_indexed_objects(cls):
return cls.objects.all()
indexed_fields = ()

View file

@ -24,7 +24,7 @@ class Command(BaseCommand):
toplevel_content_type = model.indexed_get_toplevel_content_type()
# Loop through objects
for obj in model.objects.all():
for obj in model.get_indexed_objects():
# Get key for this object
key = toplevel_content_type + ':' + str(obj.pk)