I create a model article on django 1.10. I enter the title of the article in Russian in the admin panel. prepopulated_fields = {'slug' :( 'name',)} works fine, that is, 'Test' is translated into 'test'.
But when writing to the database, only numbers and Latin characters enter the field. Why it happens? Although if you originally write the name in English, then everything is saved to the database normally. SQLite database.
models.py
class Rubric(models.Model): name = models.CharField(max_length=100, unique=True) slug = models.SlugField(unique=True) def save(self, *args, **kwargs): self.slug = slugify(self.name) super(Rubric,self).save(*args, **kwargs) class Meta: verbose_name_plural = 'Рубрики' def __str__(self): return self.name admin.py
from django.contrib import admin from blog.models import Rubric, Article class RubricAdmin(admin.ModelAdmin): prepopulated_fields = {'slug':('name',)} admin.site.register(Rubric, RubricAdmin) class ArticleAdmin(admin.ModelAdmin): prepopulated_fields = {'slug':('name',)} admin.site.register(Article, ArticleAdmin)