# Django Slugify Error

**URL:** <https://forum.djangoproject.com/t/django-slugify-error/6153>\
**Category:** Forms & APIs\
**Created:** [January 15, 2021, 1:36pm UTC](https://forum.djangoproject.com/t/django-slugify-error/6153 "2021-01-15T13:36:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![safakatar38](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/safakatar38/32/2738_2.png) [@safakatar38](https://forum.djangoproject.com/u/safakatar38)\
**Post date:** [January 15, 2021, 1:36pm UTC](https://forum.djangoproject.com/t/django-slugify-error/6153/1 "2021-01-15T13:36:00Z")

</div>

Hello guys when i tried to slug an word at template something does not work propreatly. Here is my code:  
“Taşıma Ekipmanları”|slugify  
and result of this code must be this = “tasima-ekipmanlari” but i get “tasma-ekipmanlar” and my django version is 3.1.4. I hope someone can help me  
And plus i used to use slugify at my models and this problem was still exist at models too. But i didn’t saw that as a big problem.

---

<div class="post-metadata">

**Author:** ![brotherchris65](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/brotherchris65/32/3079_2.png) [@brotherchris65](https://forum.djangoproject.com/u/brotherchris65)\
**Post date:** [January 15, 2021, 2:05pm UTC](https://forum.djangoproject.com/t/django-slugify-error/6153/2 "2021-01-15T14:05:25Z")

</div>

Are you using autoslug? https://pypi.org/project/django-autoslug/ I have had success with it.

---

<div class="post-metadata">

**Author:** ![safakatar38](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/safakatar38/32/2738_2.png) [@safakatar38](https://forum.djangoproject.com/u/safakatar38)\
**Post date:** [January 15, 2021, 2:35pm UTC](https://forum.djangoproject.com/t/django-slugify-error/6153/3 "2021-01-15T14:35:38Z")

</div>

No i don’t think i’m using this. I’m using models.SlugField. But thx for suggestion if i couldn’t solve problem i’ll install django-autoslug.

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [January 15, 2021, 2:55pm UTC](https://forum.djangoproject.com/t/django-slugify-error/6153/4 "2021-01-15T14:55:45Z")

</div>

I checked out the slugify function in django-autoslug - same thing happens.

I know just enough about Unicode to know that lower-case i with dot is a different character than lower-case i without dot, and that the two are not the same.

From the [slugify function](https://docs.djangoproject.com/en/3.1/ref/utils/#django.utils.text.slugify) docs, it does say that any characters that don’t map to ascii characters are removed. This appears to be the case here - there is no ascii mapping for the lower-case i without dot, and so it’s dropped.

I don’t believe there is a valid work-around for this without doing your own character substitution on the string before using slugify.

---

<div class="post-metadata">

**Author:** ![toppylawz](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/toppylawz/32/3044_2.png) [@toppylawz](https://forum.djangoproject.com/u/toppylawz)\
**Post date:** [January 15, 2021, 4:49pm UTC](https://forum.djangoproject.com/t/django-slugify-error/6153/5 "2021-01-15T16:49:41Z")

</div>

Since you are using models you can write this small function after the importing the proper library:

`from django.utils.text import slugify`

```
def save(self, *args, **kwargs):

        if not self.WhatYouWantToSlug and self.WhereYouWantToGeytSlugFrom:

            self.WhatYouWantToSlug= slugify(self.WhereYouWantToGeytSlugFrom)

        super(NameOfClass, self).save(*args, **kwargs)
```

---

<div class="post-metadata">

**Author:** ![Prusaseo](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/prusaseo/32/5406_2.png) [@Prusaseo](https://forum.djangoproject.com/u/Prusaseo)\
**Post date:** [December 3, 2022, 8:44am UTC](https://forum.djangoproject.com/t/django-slugify-error/6153/6 "2022-12-03T08:44:58Z")

</div>

I have the same problem.

```auto
class FirmaKategori(models.Model):
    kategori = models.CharField(max_length=250)
    description = models.CharField(max_length=5000)
    slug = models.SlugField(max_length=250, null=False, unique=True, allow_unicode=True)

    def __str__ (self):
        return self.kategori   
  
    def get_absolute_url(self):
        return reverse('firma-kategori-ekle')  

    def save(self, *args, **kwargs):
        self.slug = slugify(self.kategori, allow_unicode=False)
        super().save(*args, **kwargs)

```

I made this, and if i allow\_unicode=True, Forexample i made a category its name is Takım Tezgahları, became takım-tezgahları, but i want takim-tezgahlari…

And i looked @toppylawz code but i didnt understand, i am new on django. But i wanna solve this problem.
