use help_text to document model columns

This page is not yet available in Spanish. We are working on its translation.
If you have any questions or feedback about our current translation project, feel free to reach out to us!

Metadata

ID: python-django/model-help-text

Language: Python

Severity: Notice

Category: Best Practices

Description

Use help_text to document the fields used in your database.

Learn More

Non-Compliant Code Examples

class MyModel(models.Model):
  my_field = models.DateField()
  last_name = models.CharField(max_length=40)  # add help_text to explain what this field is doing

Compliant Code Examples

class MyModel(models.Model):
  my_field = models.DateField(help_text = "Use format YYYY/MM/DD")
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

Seamless integrations. Try Datadog Code Analysis

PREVIEWING: antoine.dussault/service-representation-ga-docs-us1