Advertisement
NubeColectiva

Formatear Fecha en un Template HTML de Django

Jun 9th, 2022 (edited)
1,241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.30 KB | None | 0 0
  1. <table class="table table-striped table-hover">
  2.   <thead>
  3.     <tr>
  4.       <th width="35%">Nombre</th>
  5.       <th>Precio</th>
  6.       <th>Stock</th>
  7.       <th>Imagen</th>
  8.       <th>Fecha de Creación</th>
  9.       <th>Acciones</th>
  10.     </tr>
  11.   </thead>
  12.   <tbody> {% for postre in object_list %} <tr>
  13.       <td>{{ postre.nombre }}</td>
  14.       <td>{{ postre.precio }}</td>
  15.       <td>{{ postre.stock }}</td>
  16.       <td width="20%">
  17.         <img src="{% static 'uploads/'%}{{postre.img}}" alt="{{postre.nombre}}" class="img-fluid" width="7%">
  18.       </td>
  19.       <!-- Formatear Fecha y Hora -->
  20.       <td>{{ postre.created_at | date:"d-m-Y h:m" }}</td>
  21.       <!-- Fin Formatear Fecha y Hora -->
  22.       <td>
  23.         <form method="POST" action="eliminar/{{postre.id}}"> {% csrf_token %} <div class="btn-group">
  24.             <a href="detalle/{{postre.id}}" title="Ver" type="button" class="btn btn-success">Ver </a>
  25.             <a href="editar/{{postre.id}}" title="Editar" type="button" class="btn btn-primary">Editar </a>
  26.             <button class="btn btn-danger" onclick="return eliminar();" type="submit"> Eliminar </button>
  27.             <!-- <a href="eliminar/{{postre.id}}" title="Eliminar"><i class="fas fa-trash"></i></a> -->
  28.           </div>
  29.         </form>
  30.       </td>
  31.     </tr> {% endfor %} </tbody>
  32. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement