Search code examples
pythondjangometaclasspep

What is the standard docstring for a django model metaclass?


Models in django can come with a meta class like so:

class Address(models.Model):
    """Address model."""

    class Meta:
        """Meta McMetaface."""

        verbose_name = "Address"
        verbose_name_plural = "Addresses"

    address_line = models.CharField(max_length=256)
    postcode = models.CharField(max_length=10)

    def __str__(self):
        """Return address without post code."""
        return self.address_line

My metaclass is whimsical at best. Does Python or Django have a standard text for meta classes?


Solution

  • There's no point in writing a docstring for Meta. It's a standard name that every model defines, and means the same thing in every model. Just don't write a docstring.