{% extends 'page.html' %}

{% block title %}Vehicles – {{ object }} – Bus Times{% endblock %}

{% block content %}

<h1>{{ object }}</h1>

{% if vehicles %}
    <table>
        <tr>
            <th scope="col"></th>
            <th scope="col">№</th>
            <th scope="col">Reg</th>
            <th scope="col">Type</th>
            <th scope="col">Last seen</th>
        </tr>
        {% for vehicle in vehicles %}
            <tr>
                <td><a href="{{ vehicle.get_absolute_url }}">{{ vehicle }}</a></td>
                <td>{% if vehicle.fleet_number %}{{ vehicle.fleet_number }}{% endif %}</td>
                <td>{% if vehicle.reg %}{{ vehicle.reg }}{% endif %}</td>
                <td>{% if vehicle.vehicle_type %}{{ vehicle.vehicle_type }}{% endif %}</td>
                <td>
                    {% if vehicle.latest_location %}
                        {% if vehicle.latest_location.service %}
                            <a href="{{ vehicle.latest_location.service.get_absolute_url }}">
                                {{ vehicle.latest_location.service.line_name }}
                            </a><br>
                        {% endif %}
                        {% if vehicle.latest_location.datetime.date == today %}
                            {{ vehicle.latest_location.datetime.time }}
                        {% else %}
                            {{ vehicle.latest_location.datetime }}
                        {% endif %}
                    {% endif %}
                </td>
            </tr>
        {% endfor %}
    </table>
{% endif %}

{% endblock %}

{% extends 'page.html' %}

{% block title %}Vehicles – {{ object }} – Bus Times{% endblock %}

{% block content %}

<h1>{{ object }}</h1>

{% if vehicles %}
    <table>
        <tr>
            <th scope="col"></th>
            <th scope="col">№</th>
            <th scope="col">Reg</th>
            <th scope="col">Type</th>
            <th scope="col">Last seen</th>
        </tr>
        {% for vehicle in vehicles %}
            <tr>
                <td><a href="{{ vehicle.get_absolute_url }}">{{ vehicle }}</a></td>
                <td>{% if vehicle.fleet_number %}{{ vehicle.fleet_number }}{% endif %}</td>
                <td>{% if vehicle.reg %}{{ vehicle.reg }}{% endif %}</td>
                <td>{% if vehicle.vehicle_type %}{{ vehicle.vehicle_type }}{% endif %}</td>
                <td>
                    {% if vehicle.latest_location %}
                        {% if vehicle.latest_location.service %}
                            <a href="{{ vehicle.latest_location.service.get_absolute_url }}">
                                {{ vehicle.latest_location.service.line_name }}
                            </a><br>
                        {% endif %}
                        {% if vehicle.latest_location.datetime.date == today %}
                            {{ vehicle.latest_location.datetime | time }}
                        {% else %}
                            {{ vehicle.latest_location.datetime }}
                        {% endif %}
                    {% endif %}
                </td>
            </tr>
        {% endfor %}
    </table>
{% endif %}

{% endblock %}

Use proper timezone for vehicle last seen
Use proper timezone for vehicle last seen
