Changed date and time representation for tasks

This commit is contained in:
Анатолий Богомолов 2024-02-03 14:51:01 +00:00
parent 8ce11f337a
commit f83a2ae152
2 changed files with 30 additions and 28 deletions

View File

@ -3,8 +3,8 @@
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<h3 class="card-title">{{ task.name }}</h3> <h3 class="card-title">{{ task.name }}</h3>
</div>
<ul class="list-group list-group-flush"> <ul class="list-group list-group-flush">
<li class="list-group-item">Дата и время: {{ task.datetime }}</li>
<li class="list-group-item">Статус: {{ task.status }}</li> <li class="list-group-item">Статус: {{ task.status }}</li>
<li class="list-group-item">Сообщение: {{ task.status_message }}</li> <li class="list-group-item">Сообщение: {{ task.status_message }}</li>
<li class="list-group-item">Действие: {{ task.type }}</li> <li class="list-group-item">Действие: {{ task.type }}</li>
@ -29,8 +29,7 @@
</select> </select>
</li> </li>
</ul> </ul>
</div> <div class="card-body">
<div class="card-footer">
<div class="btn-group mx-2" role="group"> <div class="btn-group mx-2" role="group">
<button <button
hx-delete="/api/tasks/{{task.id}}" hx-delete="/api/tasks/{{task.id}}"
@ -49,6 +48,9 @@
</button> </button>
</div> </div>
</div> </div>
<div class="card-footer">
<small class="text-body-secondary">Создано {{ task.datetime.strftime("%d.%m.%y") }} в {{ task.datetime.strftime("%H:%M") }}</small>
</div>
</div> </div>
</div> </div>
{% else %} {% else %}

View File

@ -13,7 +13,7 @@ class Task(db.Model):
session_id = Column(Integer, ForeignKey("session.id")) session_id = Column(Integer, ForeignKey("session.id"))
session: Mapped['Session'] = relationship("Session", back_populates="tasks") session: Mapped['Session'] = relationship("Session", back_populates="tasks")
datetime: Mapped[DateTime] = Column(DateTime, default=datetime.datetime.utcnow().strftime("%d.%m.%y %H:%M")) datetime: Mapped[DateTime] = Column(DateTime, default=datetime.datetime.utcnow())
status: Mapped[str] status: Mapped[str]
status_message: Mapped[str] status_message: Mapped[str]
type: Mapped[str] type: Mapped[str]