I know this is old, but it deserves a full answer that can be used in templates.
If you need to use it in a template, the preferred method is to add model methods that get these values, such as:
from django.db import models
from six import text_type
class ContactData(models.Model):
name = models.CharField(max_length=300, verbose_name=u"Name", help_text=u"Please enter your name...",null=True, blank=False)
phone = models.CharField(max_length=300, verbose_name=u"Phone number", null=True, blank=False)
def __get_label(self, field):
return text_type(self._meta.get_field(field).verbose_name)
def __get_help_text(self, field)
return text_type(self._meta.get_field(field).help_text)
@property
def name_label(self):
return self.__get_label('name')
@property
def name_help_text(self):
return self.__get_help_text('name')
@property
def phone_label(self):
return self.__get_label('phone')
@property
def phone_help_text(self):
return self.__get_help_text('phone')
Then, let us say instance
is your object in a template, this is your label
<label for="id_phone">{{ instance.phone_label }}</label>
<div id="id_phone">{{ instance.phone }}</div>
Alternatively, you could create a template tag to do this, but the model method is clearer and keeps the model self contained.