My model offers a choice list:
class Interview(models.Model):
class InterviewStatus(models.Model):
PENDING = '1-PDG'
XED = '0-XED'
DONE = '2-DON'
COMPLETE = '3-COM'
ITW_STATUS = [
(PENDING, "Interview Planned"),
(XED, "Interview Cancelled"),
(DONE, "Interview Done"),
(COMPLETE, "Interview Done and Assessed")
]
which is implemented in the model fields:
status = models.CharField(max_length=5,
blank=False,
null=False,
default=InterviewStatus.PENDING,
choices=InterviewStatus.ITW_STATUS,
verbose_name="Statut de l'interview")
When creating a new object, everything is OK. My template is written as such :
{% regroup object_list by status as status_list %}
<h1 id="topic-list">Interview List</h1>
<ul>
{% for status in status_list %}
<li><h2>{{ status.grouper }}</h2></li>
<ul>
{% for interview in status.list %}
<li><a href="{{ interview.get_absolute_url }}">{{ interview.official }}{{ interview.date_effective }} </a></li>
{% endfor %}
</ul>
What I get as an outcome in my browser is:
. 1-PDG
- item1
- item2
etc.
My Question is: How could I obtain the User friendly names instead of the values, which are supposed to be displayed exclusively in the html field:
<option value="1-PDG" selected>Interview Planned</option>