I have a problem with django 2.0, where a url that contains a unicode slug isn't matched, I searched for a solution but I didn't find one for my case, here's a simplified version of my code:
// models.py
class Level(models.Model):
name = models.CharField(max_length=100)
slug = models.SlugField(max_length=100, allow_unicode=True)
in my urls file I have those patterns:
// urls.py
urlpatterns = [
path('', views.index, name='index'),
path('level/<slug:level_slug>', views.level, name='level')]
Now if I go, say to http://127.0.0.1:8000/game/level/deuxième
I get this error:
Request Method: GET
Request URL: http://127.0.0.1:8000/game/level/deuxi%C3%A8me
Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:
game/ [name='index']
game/level/<slug:level_slug> [name='level']
admin/
accounts/
The current path, game/level/deuxième, didn't match any of these.
but if I change the item's slug to deuxieme
without the unicode character, it works fine, does anyone know the solution to this problem? thanks!