Skip to content

Conversation

@heidi-jakub
Copy link

This PR aims to solve the ImportError on Django 3.1 and above, as shown in the issue #244.

There is a previous PR with similar changes (#245) but it's not backward compatible with the older Django versions.

Comments and change requests are welcome. I did myself the license of bumping the patch number in the version.

Copy link

@PiDelport PiDelport left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Importing FieldDoesNotExist from django.core.exceptions should work on all supported versions of Django back to 1.8, so doing a conditional import with try/except should be unnecessary?

heidi-jakub and others added 3 commits December 1, 2020 11:50
Co-authored-by: Pi Delport <pjdelport@gmail.com>
Co-authored-by: Pi Delport <pjdelport@gmail.com>
Co-authored-by: Pi Delport <pjdelport@gmail.com>
from django.db.models import Model, Manager, Q
from django.db.models.fields import FieldDoesNotExist
from django.core.exceptions import FieldDoesNotExist
from django.core.exceptions import ObjectDoesNotExist

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be one the same line
from django.core.exceptions import FieldDoesNotExist, ObjectDoesNotExist

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find, will update 👍

@rh0dium
Copy link
Member

rh0dium commented Dec 21, 2020

Totally done! I didn't even see this before I did it - Thanks for the help

@rh0dium rh0dium closed this Dec 21, 2020
@rubimpassos
Copy link

Why this was closed?

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 this pull request may close these issues.

5 participants