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 import error for django 4.0 #18

Merged
merged 2 commits into from
Jun 26, 2022

Conversation

e8johan
Copy link
Contributor

@e8johan e8johan commented Jun 24, 2022

The smart_text function has been deprecated from django 4.0 and is replaced by smart_text. To work with both django 4.0 and earlier versions, we try to import smart_text, and if that fails, we import smart_str and create an alias function called smart_text.

The smart_text function has been deprecated from django 4.0 and is replaced by smart_text. To work with both django 4.0 and earlier versions, we try to import smart_text, and if that fails, we import smart_str and create an alias function called smart_text.
@e8johan
Copy link
Contributor Author

e8johan commented Jun 24, 2022

The same trick as for force_text, but for smart_text.

Copy link
Owner

@eadwinCode eadwinCode left a comment

Choose a reason for hiding this comment

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

@e8johan thanks for the change

Please can you create a compatible.py and have the implementation added there and then import smart_text from compatible.py

@e8johan
Copy link
Contributor Author

e8johan commented Jun 26, 2022

@eadwinCode no problems. I moved both force_text and smart_text into compatible.py.

Copy link
Owner

@eadwinCode eadwinCode left a comment

Choose a reason for hiding this comment

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

Awesome

@eadwinCode eadwinCode merged commit 785be32 into eadwinCode:master Jun 26, 2022
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.

None yet

2 participants