H
H
hatman2019-01-04 16:09:55
Django
hatman, 2019-01-04 16:09:55

Why doesn't a migration create a slug field in Django?

Hello everyone
, I have this model:

class Article(models.Model):
    slug = models.SlugField(unique=True, max_length=80, verbose_name="URL для статьи в человеческом виде", help_text="kak-nayti-korm-dlya-sobaki"),
    article_category = models.CharField(max_length=200, default=1, choices=ARTICLE_CATEGORY_CHOICES, 
.....

    class Meta:
        verbose_name = 'Статья'
        verbose_name_plural = 'Статьи'

    def __str__(self):
        return self.title

    def get_absolute_url(self):
        return self.slug

I do: makemigration -> migrate as a result, all fields are created, except for the slug field (if I check the migration file, this field is not there either).
Can you tell me why the slug field is not being created, maybe there are some features that I don't know?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question