mirror of
https://github.com/Hopiu/django-watson.git
synced 2026-03-16 22:00:22 +00:00
Removing Django 1.6 compatibility shim
This commit is contained in:
parent
7245bfd5d2
commit
a411c2d356
1 changed files with 6 additions and 10 deletions
|
|
@ -191,16 +191,12 @@ class SearchContextError(Exception):
|
|||
def _bulk_save_search_entries(search_entries, batch_size=100):
|
||||
"""Creates the given search entry data in the most efficient way possible."""
|
||||
if search_entries:
|
||||
if hasattr(SearchEntry.objects, "bulk_create"):
|
||||
search_entries = iter(search_entries)
|
||||
while True:
|
||||
search_entry_batch = list(islice(search_entries, 0, batch_size))
|
||||
if not search_entry_batch:
|
||||
break
|
||||
SearchEntry.objects.bulk_create(search_entry_batch)
|
||||
else:
|
||||
for search_entry in search_entries:
|
||||
search_entry.save()
|
||||
search_entries = iter(search_entries)
|
||||
while True:
|
||||
search_entry_batch = list(islice(search_entries, 0, batch_size))
|
||||
if not search_entry_batch:
|
||||
break
|
||||
SearchEntry.objects.bulk_create(search_entry_batch)
|
||||
|
||||
|
||||
class SearchContextManager(local):
|
||||
|
|
|
|||
Loading…
Reference in a new issue