﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
33472	slugify() don't work when used in model's save() method.	Vitalii Khrystiuk	nobody	"This is code in my models.py I was using:


{{{
from django.db import models
from django.utils import timezone
from markdownx.models import MarkdownxField
from .utils import markdownify
from django.contrib.auth.models import User
from django.dispatch import receiver
from django.utils.text import slugify

STATUS = (
        (0,""Draft""),
        (1,""Publish"")
)


class Blog(models.Model):
    title = models.CharField(max_length=200, unique=True)
    slug = models.SlugField(max_length=200, unique=True, allow_unicode=False)
    date = models.DateTimeField(auto_now_add=True)
    description = MarkdownxField()
    date_updated = models.DateTimeField(auto_now=True)
    author = models.ForeignKey('auth.User', on_delete=models.CASCADE)
    status = models.IntegerField(choices=STATUS, default=0)

    class Meta:
        ordering = ['-date']

    def __str__(self):
        return self.title

    def save(self, *args, **kwargs):
            self.slug = slugify(self.title)
            super().save(*args, **kwargs)

    def formatted_markdown(self):
        return markdownify(self.description)
}}}

When model is saved, slug field is just empty.

I've checked if this code is working with ""python-slugify"" package, and it works, creating a valid slug, so issue is definitely in Django slugify function. 
"	Bug	closed	Utilities	4.0	Normal	worksforme	slugify, utils		Unreviewed	0	0	0	0	0	0
