diff --git a/vrobbler/apps/lifeevents/views.py b/vrobbler/apps/lifeevents/views.py index ed3609c..83912ce 100644 --- a/vrobbler/apps/lifeevents/views.py +++ b/vrobbler/apps/lifeevents/views.py @@ -1,12 +1,10 @@ -from django.views import generic +from scrobbles.views import ScrobbleableDetailView, ScrobbleableListView from lifeevents.models import LifeEvent -class LifeEventListView(generic.ListView): +class LifeEventListView(ScrobbleableListView): model = LifeEvent - paginate_by = 20 -class LifeEventDetailView(generic.DetailView): +class LifeEventDetailView(ScrobbleableDetailView): model = LifeEvent - slug_field = "uuid" diff --git a/vrobbler/apps/scrobbles/views.py b/vrobbler/apps/scrobbles/views.py index b7c6b5d..37dee71 100644 --- a/vrobbler/apps/scrobbles/views.py +++ b/vrobbler/apps/scrobbles/views.py @@ -234,6 +234,11 @@ class RecentScrobbleList(ListView): data["daily_calories"] = get_daily_calories_for_user_by_day( self.request.user.id, date ) + data["life_events_in_progress"] = Scrobble.objects.filter( + user=self.request.user, + life_event__isnull=False, + in_progress=True, + ).order_by("-timestamp") else: data["weekly_data"] = week_of_scrobbles() data["counts"] = scrobble_counts() diff --git a/vrobbler/templates/lifeevents/lifeevent_detail.html b/vrobbler/templates/lifeevents/lifeevent_detail.html new file mode 100644 index 0000000..0c0baa5 --- /dev/null +++ b/vrobbler/templates/lifeevents/lifeevent_detail.html @@ -0,0 +1,69 @@ +{% extends "base_list.html" %} + +{% block title %}{{object.title}}{% endblock %} + +{% block lists %} + +
+
+ {% if object.description%} +

{{object.description|safe|linebreaks|truncatewords:160}}

+
+ {% endif %} +
+
+
+

{{scrobbles.count}} scrobbles

+

+ Play again +

+
+
+
+

Last scrobbles

+ +
+ + + + + + + + + + + {% for scrobble in scrobbles.all|dictsortreversed:"timestamp" %} + + + + + + + {% endfor %} + +
DateTitleNotesSource
{{scrobble.local_timestamp}}{{scrobble.logdata.title}}{{scrobble.logdata.notes_as_str|safe}}{{scrobble.source}}
+
+
+ + {% if is_paginated %} + + {% endif %} +
+{% endblock %} diff --git a/vrobbler/templates/lifeevents/lifeevent_list.html b/vrobbler/templates/lifeevents/lifeevent_list.html new file mode 100644 index 0000000..14a5c3a --- /dev/null +++ b/vrobbler/templates/lifeevents/lifeevent_list.html @@ -0,0 +1,10 @@ +{% extends "base_list.html" %} +{% block title %}Life Events{% endblock %} + +{% block lists %} +
+
+
{% include "_scrobblable_list.html" %}
+
+
+{% endblock %} diff --git a/vrobbler/templates/scrobbles/_last_scrobbles.html b/vrobbler/templates/scrobbles/_last_scrobbles.html index e1cee3e..93725d6 100644 --- a/vrobbler/templates/scrobbles/_last_scrobbles.html +++ b/vrobbler/templates/scrobbles/_last_scrobbles.html @@ -25,6 +25,28 @@

No food today

{% endif %} +

Life Events

+ {% if life_events_in_progress %} +
+ + + + + + + + + + {% for scrobble in life_events_in_progress %} + {% include "scrobbles/_row.html" %} + {% endfor %} + +
StartedTitleTime
+
+ {% else %} +

No life events in progress

+ {% endif %} +

Moods

{% if Mood %} {% with scrobbles=Mood count=Mood_count time=Mood_time %}