Atrox / sweetify-django

SweetAlert integration for Django
BSD 3-Clause "New" or "Revised" License
55 stars 21 forks source link

fix(bug): changed deprecated method `force_text` #31

Closed Metarizard closed 2 years ago

Metarizard commented 2 years ago

As Django 4.0 made its release, some features were deprecated (https://docs.djangoproject.com/en/4.0/releases/4.0/#features-removed-in-4-0). In particular, django.utils.encoding.force_text() was removed (its use had been deprecated since Django 3.0 - https://docs.djangoproject.com/en/3.0/ref/utils/#django.utils.encoding.force_text). In the current state, this method is being used in sweetify/encoders.py so ImportErrors will be raised from Django 4.0 onward, as reported in #29 .

This PR solves #29 by changing force_text to force_str, method that can be used with previous versions (from Django 1.8 to Django 2.2 - https://docs.djangoproject.com/en/1.8/ref/utils/#django.utils.encoding.force_str, https://docs.djangoproject.com/en/2.2/ref/utils/#django.utils.encoding.force_str) so this fix is backwards compatible.

Atrox commented 2 years ago

Thanks :)!