Allow deleting sessions
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
b8a15e43db
commit
4b45127335
|
@ -1,4 +1,5 @@
|
|||
## Unreleased
|
||||
* Allow deleting sessions
|
||||
* Redirect after adding game/platform/purchase/session
|
||||
* Fix display of duration_manual
|
||||
* Fix display of duration_calculated, display durations less than a minute
|
||||
|
|
|
@ -12,5 +12,5 @@ COPY entrypoint.sh /
|
|||
RUN chmod +x /entrypoint.sh
|
||||
USER timetracker
|
||||
EXPOSE 8000
|
||||
ENV VERSION_NUMBER 0.1.0-17-ga1309c3
|
||||
ENV VERSION_NUMBER 0.1.0-18-gb8a15e4
|
||||
ENTRYPOINT [ "/entrypoint.sh" ]
|
|
@ -766,8 +766,8 @@ select {
|
|||
max-width: 1024px;
|
||||
}
|
||||
|
||||
.grid-cols-4 {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
.grid-cols-5 {
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.flex-col {
|
||||
|
|
|
@ -9,11 +9,12 @@
|
|||
<a class="dark:text-white hover:underline" href="{% url 'list_sessions' %}">View all sessions</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="grid grid-cols-4 gap-4 shadow rounded-xl max-w-screen-lg mx-auto dark:bg-slate-700 p-2 justify-center">
|
||||
<div class="grid grid-cols-5 gap-4 shadow rounded-xl max-w-screen-lg mx-auto dark:bg-slate-700 p-2 justify-center">
|
||||
<div class="dark:border-white dark:text-slate-300 text-lg">Name</div>
|
||||
<div class="dark:border-white dark:text-slate-300 text-lg">Start</div>
|
||||
<div class="dark:border-white dark:text-slate-300 text-lg">End</div>
|
||||
<div class="dark:border-white dark:text-slate-300 text-lg">Duration</div>
|
||||
<div></div>
|
||||
{% for data in dataset %}
|
||||
<div class=""><a class="dark:text-white hover:underline" href="{% url 'list_sessions' data.purchase.id %}">{{ data.purchase }}</a></div>
|
||||
<div class="dark:text-slate-400">{{ data.timestamp_start | date:"d/m/Y H:i" }}</div>
|
||||
|
@ -27,6 +28,9 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
<div class="dark:text-slate-400">{{ data.duration_formatted }}{% if data.duration_manual %} (M){% endif %}</div>
|
||||
<div>
|
||||
<a href="{% url 'delete_session' data.id %}"><button>❌</button></a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock content %}
|
|
@ -12,6 +12,11 @@ urlpatterns = [
|
|||
views.update_session,
|
||||
name="update_session",
|
||||
),
|
||||
path(
|
||||
"delete_session/by-id/<int:session_id>",
|
||||
views.delete_session,
|
||||
name="delete_session",
|
||||
),
|
||||
path("add-purchase/", views.add_purchase, name="add_purchase"),
|
||||
path("list-sessions/", views.list_sessions, name="list_sessions"),
|
||||
path(
|
||||
|
|
|
@ -37,6 +37,12 @@ def update_session(request, session_id=None):
|
|||
return redirect("list_sessions")
|
||||
|
||||
|
||||
def delete_session(request, session_id=None):
|
||||
session = Session.objects.get(id=session_id)
|
||||
session.delete()
|
||||
return redirect("list_sessions")
|
||||
|
||||
|
||||
def list_sessions(request, purchase_id=None):
|
||||
context = {}
|
||||
|
||||
|
|
Loading…
Reference in New Issue