[Django]-Django โ€“ Forms โ€“ change field names on template

6๐Ÿ‘

โœ…

Set a name on your fields. See verbose field names in the documentation.

class BHA_Component(models.Model):
    item_description = models.CharField('Item Description', max_length=111)

The verbose name will automatically be picked up (and capitalized) by the form to create label text.

I cannot check right now, but if my memory is correct, I believe you should be using field.label rather than field.name in your label though.

๐Ÿ‘คspectras

Leave a comment