Skip to content
Oscar Chan edited this page Dec 21, 2022 · 1 revision

Django

Should I name my model singular or plural?

Singular. Django will automatically add an 's' to the class name when printing a plural name, like in the Admin page.

If your model has a non-'s' plural (English 'story' / 'stories', Latin 'alumnus' / 'alumni', Greek 'amoeba' / 'amoebae', etc.), you may set the plural manually:

class Story(models.Model):
    class Meta:
        verbose_name_plural = "stories"

Common bugs

Everything inside my Vagrant cannot use the internet.

To make sure this is the issue, try typing ping google.com in the Vagrant VM. If that fails, check this post: https://serverfault.com/questions/453185/vagrant-virtualbox-dns-10-0-2-3-not-working

I'm trying to merge my pull request, but Travis CI says there are conflicting migrations.

Do NOT merge the pull request anyway. Some of your migrations happened in parallel to other people's migrations for the same app. Check your commit history to find out which conflicting migration files in the app's migrations directory were created by you. Delete those migration files, and then re-run make makemigrations and make migrate.