Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AttributeError for django 3.1 #111

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions aldryn_search/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import importlib
import re

from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.core.exceptions import FieldDoesNotExist, ImproperlyConfigured
from django.utils.encoding import force_text

from cms.utils.i18n import get_language_code
Expand All @@ -14,7 +13,7 @@
from haystack import DEFAULT_ALIAS
from haystack.indexes import SearchIndex
from lxml.etree import ParseError, ParserError
from lxml.html.clean import Cleaner as LxmlCleaner
from lxml_html_clean import Cleaner as LxmlCleaner

from .conf import settings

Expand Down Expand Up @@ -122,7 +121,7 @@ def get_field_value(obj, name):

try:
obj._meta.get_field(name)
except (AttributeError, models.FieldDoesNotExist):
except (AttributeError, FieldDoesNotExist):
# we catch attribute error because obj will not always be a model
# specially when going through multiple relationships.
value = getattr(obj, name, None) or ''
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


REQUIREMENTS = [
'lxml',
'lxml[html_clean]',
'setuptools',
'django-appconf',
'django-cms>=3.4.5',
Expand Down