django model get field verbose name
from django.db import models
class YourModel(models.Model):
your_field = models.CharField(max_length=255, verbose_name="Your Verbose Name")
Import the
models
module from Django.Define a Django model class named
YourModel
by inheriting frommodels.Model
.Inside the model class, define a field named
your_field
using theCharField
class frommodels
. Adjust the field's parameters as needed, such asmax_length
in this example.Use the
verbose_name
parameter within the field definition to set a human-readable name for the field. In this example, the verbose name is set to "Your Verbose Name".