Changed date and time representation for tasks
This commit is contained in:
parent
8ce11f337a
commit
f83a2ae152
|
@ -3,34 +3,33 @@
|
||||||
<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>
|
||||||
<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_message }}</li>
|
|
||||||
<li class="list-group-item">Действие: {{ task.type }}</li>
|
|
||||||
|
|
||||||
<li class="list-group-item">
|
|
||||||
<label class="form-label">Сессия:</label>
|
|
||||||
<select
|
|
||||||
name="session"
|
|
||||||
hx-put="/api/tasks/{{task.id}}/change"
|
|
||||||
hx-trigger="change"
|
|
||||||
hx-confirm="Вы уверены, что хотите поменять сессию?"
|
|
||||||
hx-swap="none"
|
|
||||||
class="form-select form-select-lg mb-3"
|
|
||||||
>
|
|
||||||
{% for session in sessions %}
|
|
||||||
{% if task.session.name == session.name %}
|
|
||||||
<option selected value="{{ session.id }}">{{ session.name }}</option>
|
|
||||||
{% else %}
|
|
||||||
<option value="{{ session.id }}">{{ session.name }}</option>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer">
|
<ul class="list-group list-group-flush">
|
||||||
|
<li class="list-group-item">Статус: {{ task.status }}</li>
|
||||||
|
<li class="list-group-item">Сообщение: {{ task.status_message }}</li>
|
||||||
|
<li class="list-group-item">Действие: {{ task.type }}</li>
|
||||||
|
|
||||||
|
<li class="list-group-item">
|
||||||
|
<label class="form-label">Сессия:</label>
|
||||||
|
<select
|
||||||
|
name="session"
|
||||||
|
hx-put="/api/tasks/{{task.id}}/change"
|
||||||
|
hx-trigger="change"
|
||||||
|
hx-confirm="Вы уверены, что хотите поменять сессию?"
|
||||||
|
hx-swap="none"
|
||||||
|
class="form-select form-select-lg mb-3"
|
||||||
|
>
|
||||||
|
{% for session in sessions %}
|
||||||
|
{% if task.session.name == session.name %}
|
||||||
|
<option selected value="{{ session.id }}">{{ session.name }}</option>
|
||||||
|
{% else %}
|
||||||
|
<option value="{{ session.id }}">{{ session.name }}</option>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="card-body">
|
||||||
<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 %}
|
||||||
|
|
|
@ -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]
|
||||||
|
|
Loading…
Reference in New Issue