Repository: django-oscar/django-oscar

Issue:
Question: Would a PR for Django 2.2 compatibility in the 1.x branch be accepted?
### Issue Summary

We'd like to create a Django-Oscar 1.x version (based off 1.6.7) that supports Django 2.2. Would the maintainers be willing to accept a PR for this, and make a release?

### Background

We're in the process of upgrading our Django-Oscar+API-based application to a supported version of Django. Unfortunately, while 1.6.7 does support Django 2.1, it does not support 2.2.

So we are faced with a choice:

1. Upgrade to Django-Oscar 2
2. See if we can get Django-Oscar 1 to work with Django 2.2

It seems that the second option would require the least effort. We are expecting a lot of work from the Django-Oscar 2 upgrade, and the changes between Django 2.1 and 2.2 seem minor by comparison.

We'd like to know if the maintainers think that Oscar1.x + Django2.2 compatibility might be useful enough to cut a release. I'm also wondering why there is no such branch/release yet: There might be blocking issues that i'm not aware of, so i'm asking for insights as to what i might run in to. 

### Questions

1. Would a Oscar1.x + Django2.2 release be feasible?
2. Are you aware of blocking issues that make this hard to achieve?


Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -19,7 +19,7 @@
 from oscar import get_version  # noqa isort:skip
 
 install_requires = [
-    'django>=1.11,<2.2',
+    'django>=1.11,<2.3',
     # PIL is required for image fields, Pillow is the "friendly" PIL fork
     'pillow>=4.0',
     # We use the ModelFormSetView from django-extra-views for the basket page
diff --git a/src/oscar/apps/customer/utils.py b/src/oscar/apps/customer/utils.py
--- a/src/oscar/apps/customer/utils.py
+++ b/src/oscar/apps/customer/utils.py
@@ -5,11 +5,10 @@
 from django.core.mail import EmailMessage, EmailMultiAlternatives
 from django.urls import reverse
 from django.utils.encoding import force_bytes
-from django.utils.http import urlsafe_base64_encode
 
+from oscar.core.compat import urlsafe_base64_encode
 from oscar.core.loading import get_model
 
-
 CommunicationEvent = get_model('order', 'CommunicationEvent')
 Email = get_model('customer', 'Email')
 
@@ -134,7 +133,7 @@ def get_password_reset_url(user, token_generator=default_token_generator):
     """
     kwargs = {
         'token': token_generator.make_token(user),
-        'uidb64': urlsafe_base64_encode(force_bytes(user.id)).decode(),
+        'uidb64': urlsafe_base64_encode(force_bytes(user.id)),
     }
     return reverse('password-reset-confirm', kwargs=kwargs)
 
diff --git a/src/oscar/core/compat.py b/src/oscar/core/compat.py
--- a/src/oscar/core/compat.py
+++ b/src/oscar/core/compat.py
@@ -6,6 +6,7 @@
 from django.contrib.auth.models import User
 from django.core.exceptions import ImproperlyConfigured
 from django.utils import six
+from django.utils.http import urlsafe_base64_encode as django_urlsafe_base64_encode
 
 from oscar.core.loading import get_model
 
@@ -196,3 +197,12 @@ def writerow(self, row):
     def writerows(self, rows):
         for row in rows:
             self.writerow(row)
+
+
+def urlsafe_base64_encode(value):
+    # In Django 2.2 function returns string, but not bytestring, so it is necessary
+    # to decode value only for the previous Django versions.
+    encoded_value = django_urlsafe_base64_encode(value)
+    if isinstance(encoded_value, bytes):
+        encoded_value = encoded_value.decode()
+    return encoded_value


Test patch: