Интервал в шаблоне Django - PullRequest
0 голосов
/ 30 мая 2018

У меня есть поле типа интервала, которое содержит часы и минуты в следующем формате: «28:00».Но в моем шаблоне это переводится как «1 день, 4:00:00». Как мне сохранить это «28:00» в моем шаблоне?

Мой шаблон:

<table class="table table-bordered ">
    <thead align="center">
        <th class="text-center" scope="col">User</th>
        <th class="text-center" scope="col">Week number</th>
        <th class="text-center" scope="col">Total H</th>
    </thead>
    <tbody>
        {% for tp in resume_h %}
        <tr  scope="row">
            <td class="text-center col-md-1">{{ tp.user_name  }}</td>
            <td class="text-center col-md-1">{{ tp.num_semaine }}</td>>
            <td class="text-center col-md-1">{{ tp.hours_total|linebreaksbr }}</td>
        </tr>
        {% endfor %}
    </tbody>
</table>

Моя модель:

class hours(models.Model):
    user_name = models.CharField(max_length=50, blank=True, null=True)
    num_semaine = models.IntegerField(("No:"),blank=True, null=True)    
    hours_total = models.TimeField(("H"),blank=True, null=True)

    def __str__(self):
        return str(self.user_name)

Спасибо

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...