From 74a17cbbfc00ba9ff7250705adb0ad104c4bd61f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jean-S=C3=A9bastien=20Caux?= <git@jscaux.org>
Date: Fri, 22 Oct 2021 18:08:10 +0200
Subject: [PATCH] Allow unicode slug. Fixes SCIPOST-1AX

---
 scipost_django/SciPost_v1/urls.py   | 2 ++
 scipost_django/common/converters.py | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/scipost_django/SciPost_v1/urls.py b/scipost_django/SciPost_v1/urls.py
index 4eff807f9..4cd207210 100644
--- a/scipost_django/SciPost_v1/urls.py
+++ b/scipost_django/SciPost_v1/urls.py
@@ -17,6 +17,7 @@ from comments.converters import (
     CommentDOILabelConverter, AuthorReplyDOILabelConverter
 )
 from common.converters import (
+    UnicodeSlugConverter,
     FourDigitYearConverter, TwoDigitMonthConverter, TwoDigitDayConverter
 )
 from journals.converters import (
@@ -45,6 +46,7 @@ register_converter(CollegeSlugConverter, 'college')
 register_converter(CommentDOILabelConverter, 'comment_doi_label')
 register_converter(AuthorReplyDOILabelConverter, 'author_reply_doi_label')
 # common
+register_converter(UnicodeSlugConverter, 'slug')
 register_converter(FourDigitYearConverter, 'YYYY')
 register_converter(TwoDigitMonthConverter, 'MM')
 register_converter(TwoDigitDayConverter, 'DD')
diff --git a/scipost_django/common/converters.py b/scipost_django/common/converters.py
index 50f0767ed..76a8a94c2 100644
--- a/scipost_django/common/converters.py
+++ b/scipost_django/common/converters.py
@@ -2,6 +2,13 @@ __copyright__ = "Copyright © Stichting SciPost (SciPost Foundation)"
 __license__ = "AGPL v3"
 
 
+from django.urls.converters import StringConverter
+
+
+class UnicodeSlugConverter(StringConverter):
+    regex = '[-\w_]+'
+
+
 class FourDigitYearConverter:
     regex = '[0-9]{4}'
 
-- 
GitLab