NewsLink is really easy, given Django’s declarative syntax, as shown in Example 10.21.
70 class NewsLink(models.Model): . ... 72 slug = models.SlugField(max_length=63)
That’s it! You’re done. (Take heed: we have not set the
unique option on the field.)
Mirroring this change in the database and making the lives of your future self and your coworkers easy is a little trickier, especially because we have a database with data in it.
When we call
makemigrations, Django compares the current state of our models with the historical models it builds thanks to the
AppConfig classes. It ...