I have a problem with django-taggit persian[farsi-fa]

I have a problem when I put persian tags in the Django admin panel I get this error in template:

Reverse for 'post_tag' with arguments '('',)' not found. 1 pattern(s) tried: ['tags/(?P<tag_slug>[-a-zA-Z0-9_]+)/\\Z']

Note: when I put English and other languages tag I don't get this error and it works True.

models.py

from django.db import model
from taggit.managers import TaggableManager

class Article(models.Model):
    ...
    tags = TaggableManager()

views.py

from django.views.generic import ListView

class ArticleTagList(ListView):
    model = Article
    template_name = 'blog/list.html'

    def get_queryset(self):
        return Article.objects.filter(tag__slug=self.kwargs.get('tag_slug'))

urls.py

from django.url import path
from .views import ArticleTagList

app_name = 'blog'
urlpatterns = [
    ...
    path("tags/<slug:tag_slug>/", ArticleTagList.as_view(), name='post_tag'),
    ...
]

blog/list.html

 ...
 
 {% for tag in article.tags.all %}
     <a href="{% url 'blog:post_tag' tag.slug %}">{{ tag.name }}</a>
 {% endfor %}

 ...

enter image description here

I change django-taggit version to last version bun not working. I'm now using 3.1.0 version. What can I do? Is there any solution for this problem?

Back to Top