Urlpatterns в django для имен в юникоде
Я работал над категориями на своем сайте и после добавления категории с id типа 11 или больше возникла ошибка . Reverse for 'category' with arguments '('more-cat', 14)' not found. 1 шаблон(ы) проверены: ['category/(?P[\w-]+)/(?P[0-9])/']
это urls.py
re_path(r'^category/(?P<slug>[\w-]+)/(?P<id>[0-9])/' , views.listofproducts , name="category"),
и его models.py
class category(models.Model):
sub_category = models.ForeignKey('self' , on_delete=models.CASCADE , null=True , blank=True , related_name='sub')
sub_cat = models.BooleanField(default=False)
name = models.CharField(max_length=200 , blank=True , null=True)
create = models.DateTimeField(auto_now_add=True ,blank=True , null=True)
update = models.DateTimeField(auto_now=True ,blank=True , null=True)
slug = models.SlugField(allow_unicode=True , unique=True , null=True , blank=True)
image = models.ImageField(upload_to = 'category' , blank=True , null=True)
def __str__(self):
return self.name
def get_absolute_url(self):
return reverse("home:category" , args=[self.slug , self.id])
пожалуйста, помогите мне с этой проблемой!