inforian / drf-pyotp

pyotp extension for Django Rest Framework
Other
6 stars 6 forks source link

Quick fix to enable this package to work with Django 4 and the older versions #23

Closed vigneshwrn9 closed 1 year ago

vigneshwrn9 commented 1 year ago

Hi There, would it be possible to add this line of code within the below files. This helps with Django4.0 and would also work with the older version.

  1. "rest_pyotp/models.py"

From

from django.utils.translation import ugettext_lazy as _

To

try:
    from django.utils.translation import ugettext_lazy as _
except ImportError:
    from django.utils.translation import gettext_lazy as _
  1. "rest_pyotp/routers.py"

From

from django.conf.urls import url

To

try:
    from django.conf.urls import url
except ImportError:
    from django.urls import re_path as url
inforian commented 1 year ago

@vigneshwrn9 Thanks for the suggestion. I have released the fix you can verify the same on latest version 0.5.7 .

vigneshwrn9 commented 1 year ago

@inforian Thank you for the quick fix! much appreciated