{% load static %}
        <div class="col">
          <div class="card shadow-sm">
            {% if d.item.image.exists %}
            <a href="{{d.item.get_absolute_url}}"><img class="card-img-top" src="{{ d.item.image.first.image.url }}" alt="{{ d.item }}"></a>
            {% else %}
            <!-- Do not show the "Coming soon" image when running in a single card column mode (e.g. on mobile) -->
            <a href="{{d.item.get_absolute_url}}"><img class="card-img-top d-none d-sm-block" src="{% static DEFAULT_CARD_IMAGE %}" alt="{{ d.item }}"></a>
            {% endif %}
            <div class="card-body">
              <p class="card-text" style="position: relative;">
                <strong>{{ d.item }}</strong>
                <a class="stretched-link" href="{{ d.item.get_absolute_url }}"></a>
              </p>
              {% if d.item.tags.all %}
              <p class="card-text"><small>Tags:</small>
                {% for t in d.item.tags.all %}<a href="{% url 'filtered' _filter="tag" search=t.slug %}" class="badge rounded-pill bg-primary">
                {{ t.name }}</a>{# new line is required #}
                {% endfor %}
              </p>
              {% endif %}
              <table class="table table-striped">
                <thead>
                  <tr>
                    <th colspan="2" scope="row">Rolling stock</th>
                  </tr>
                </thead>
                <tbody class="table-group-divider">
                  <tr>
                    <th class="w-33" scope="row">Type</th>
                    <td>{{ d.item.rolling_class.type }}</td>
                  </tr>
                  <tr>
                    <th scope="row">Company</th>
                    <td>
                      <a href="{% url 'filtered' _filter="company" search=d.item.rolling_class.company.slug %}"><abbr title="{{ d.item.rolling_class.company.extended_name }}">{{ d.item.rolling_class.company }}</abbr></a>
                    </td>
                  </tr>
                  <tr>
                    <th scope="row">Class</th>
                    <td>{{ d.item.rolling_class.identifier }}</td>
                  </tr>
                  <tr>
                    <th scope="row">Road number</th>
                    <td>{{ d.item.road_number }}</td>
                  </tr>
                  <tr>
                    <th scope="row">Era</th>
                    <td>{{ d.item.era }}</td>
                  </tr>
                  <tr>
                    <th class="w-33" scope="row">Manufacturer</th>
                    <td>{%if d.item.manufacturer %}
                      <a href="{% url 'filtered' _filter="manufacturer" search=d.item.manufacturer.slug %}">{{ d.item.manufacturer }}{% if d.item.manufacturer.website %}</a> <a href="{{ d.item.manufacturer.website }}" target="_blank"><i class="bi bi-box-arrow-up-right"></i></a>{% endif %}
                    {% endif %}</td>
                  </tr>
                  <tr>
                    <th scope="row">Scale</th>
                    <td><a href="{% url 'filtered' _filter="scale" search=d.item.scale.slug %}"><abbr title="{{ d.item.scale.ratio }} - {{ d.item.scale.tracks }}">{{ d.item.scale }}</abbr></a></td>
                  </tr>
                  <tr>
                    <th scope="row">Item number</th>
                    <td>{{ d.item.item_number }}</td>
                  </tr>
                </tbody>
              </table>
              {% if d.item.decoder %}
              <table class="table table-striped">
                <thead>
                  <tr>
                    <th colspan="2" scope="row">DCC data</th>
                  </tr>
                </thead>
                <tbody class="table-group-divider">
                  <tr>
                    <th class="w-33" scope="row">Decoder</th>
                    <td>{{ d.item.decoder }}</td>
                  </tr>
                  <tr>
                    <th scope="row">Address</th>
                    <td>{{ d.item.address }}</td>
                  </tr>
                </tbody>
              </table>
              {% endif %}
              <div class="d-grid gap-2 mb-1 d-md-block">
               <a class="btn btn-sm btn-outline-primary" href="{{d.item.get_absolute_url}}">Show all data</a>
                {% if request.user.is_staff %}<a class="btn btn-sm btn-outline-danger" href="{% url 'admin:roster_rollingstock_change' d.item.pk %}">Edit</a>{% endif %}
              </div>
            </div>
          </div>
        </div>
