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

AttributeError: module 'django.db.models' has no attribute 'FieldDoesNotExist' #110

Open
didierCH opened this issue Apr 21, 2021 · 0 comments · May be fixed by #111
Open

AttributeError: module 'django.db.models' has no attribute 'FieldDoesNotExist' #110

didierCH opened this issue Apr 21, 2021 · 0 comments · May be fixed by #111

Comments

@didierCH
Copy link

didierCH commented Apr 21, 2021

The following line of code will cause issues in Django 3.1 and later:

except (AttributeError, models.FieldDoesNotExist):

As in the Django 3.1 release notes is stated: "The compatibility import of django.core.exceptions.FieldDoesNotExist in django.db.models.fields is removed."

A possible fix for this is to import from django.core import exceptions and replace the following except (AttributeError, models.FieldDoesNotExist): with except (AttributeError, exceptions.FieldDoesNotExist):

@wfehr wfehr linked a pull request Jun 28, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant