From e7ac0af6047dfb911f20df11fea3e2aa44eeea8c Mon Sep 17 00:00:00 2001
From: Erwan Rouchet <rouchet@teklia.com>
Date: Mon, 6 May 2019 08:37:55 +0000
Subject: [PATCH] Bump to Django 2.2

---
 arkindex/documents/models.py | 9 +++++++++
 arkindex/users/api.py        | 2 +-
 base/requirements.txt        | 2 +-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/arkindex/documents/models.py b/arkindex/documents/models.py
index 55aa88f1a4..6291bca40f 100644
--- a/arkindex/documents/models.py
+++ b/arkindex/documents/models.py
@@ -367,6 +367,9 @@ class Page(Element):
             return True
         return False
 
+    # see https://code.djangoproject.com/ticket/30333
+    __hash__ = models.Model.__hash__
+
     def __eq__(self, other):
         # Prevent AttributeError when a Page is an Element and its subclass has not been used
         if not isinstance(other, Page):
@@ -693,6 +696,9 @@ class MetaData(models.Model):
         # TODO: Remove is_list when we move to Entities
         return self.name.lower() in ('persons', 'places', 'subjects')
 
+    # see https://code.djangoproject.com/ticket/30333
+    __hash__ = models.Model.__hash__
+
     def __eq__(self, other):
         if not isinstance(other, MetaData):
             return False
@@ -776,6 +782,9 @@ class InterpretedDate(models.Model):
     def __iter__(self):
         return iter((self.year, self.month, self.day))
 
+    # see https://code.djangoproject.com/ticket/30333
+    __hash__ = models.Model.__hash__
+
     def __eq__(self, other):
         return tuple(self) == tuple(other) and self.type == other.type
 
diff --git a/arkindex/users/api.py b/arkindex/users/api.py
index c0742ac74c..622fdd4eaf 100644
--- a/arkindex/users/api.py
+++ b/arkindex/users/api.py
@@ -159,7 +159,7 @@ class UserEmailVerification(RedirectView):
             return '/'
 
         return reverse('password_reset_confirm', kwargs={
-            'uidb64': urlsafe_base64_encode(str(user.id).encode()).decode(),
+            'uidb64': urlsafe_base64_encode(str(user.id).encode()),
             'token': self.request.GET['token'],
         })
 
diff --git a/base/requirements.txt b/base/requirements.txt
index 3ab286dabc..ecd273353f 100644
--- a/base/requirements.txt
+++ b/base/requirements.txt
@@ -1,4 +1,4 @@
-Django==2.1
+Django==2.2
 elasticsearch==6.2.0
 ijson==2.3
 lxml==4.2.3
-- 
GitLab