Skip to content

Commit 62dc6f9

Browse files
committed
Fix AttributeError on Django1.7
1 parent 659ca85 commit 62dc6f9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/models.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ def __init__(self, model, client):
4545
self.__client = client
4646
self.__set_index(client)
4747

48-
all_fields = [f.name for f in model._meta.get_fields()]
48+
try:
49+
all_fields = [f.name for f in model._meta.get_fields()]
50+
except AttributeError: # Django 1.7
51+
all_fields = model._meta.get_all_field_names()
4952

5053
# Avoid error when there is only one field to index
5154
if isinstance(self.fields, str):

0 commit comments

Comments
 (0)