[templates] Add longplay complete to templates
This commit is contained in:
@ -11,17 +11,15 @@ from django_extensions.db.models import TimeStampedModel
|
|||||||
from imagekit.models import ImageSpecField
|
from imagekit.models import ImageSpecField
|
||||||
from imagekit.processors import ResizeToFit
|
from imagekit.processors import ResizeToFit
|
||||||
from puzzles.sources import ipdb
|
from puzzles.sources import ipdb
|
||||||
from scrobbles.dataclasses import JSONDataclass
|
from scrobbles.dataclasses import BaseLogData, WithPeopleLogData, LongPlayLogData
|
||||||
from scrobbles.mixins import ScrobblableConstants, ScrobblableMixin
|
from scrobbles.mixins import ScrobblableConstants, ScrobblableMixin
|
||||||
|
|
||||||
BNULL = {"blank": True, "null": True}
|
BNULL = {"blank": True, "null": True}
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class PuzzleLogData(JSONDataclass):
|
class PuzzleLogData(BaseLogData, WithPeopleLogData, LongPlayLogData):
|
||||||
with_people: Optional[int] = None
|
|
||||||
rating: Optional[str] = None
|
rating: Optional[str] = None
|
||||||
notes: Optional[str] = None
|
|
||||||
|
|
||||||
|
|
||||||
class PuzzleManufacturer(TimeStampedModel):
|
class PuzzleManufacturer(TimeStampedModel):
|
||||||
|
|||||||
@ -949,7 +949,7 @@ class ScrobbleDetailView(DetailView):
|
|||||||
|
|
||||||
log = self.object.log or {}
|
log = self.object.log or {}
|
||||||
initial_notes = log.get("notes", [])
|
initial_notes = log.get("notes", [])
|
||||||
if isinstance(initial_notes, list) and isinstance(initial_notes[0], dict):
|
if isinstance(initial_notes, list) and len(initial_notes) > 0 and isinstance(initial_notes[0], dict):
|
||||||
notes_str = note_list_to_str(notes)
|
notes_str = note_list_to_str(notes)
|
||||||
else:
|
else:
|
||||||
notes_str = "\n".join(initial_notes)
|
notes_str = "\n".join(initial_notes)
|
||||||
|
|||||||
43
vrobbler/templates/_longplay_scrobblable_list.html
Normal file
43
vrobbler/templates/_longplay_scrobblable_list.html
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
{% load urlreplace %}
|
||||||
|
{% load naturalduration %}
|
||||||
|
|
||||||
|
<table class="table table-striped table-sm">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Latest</th>
|
||||||
|
<th scope="col">Title</th>
|
||||||
|
<th scope="col">Scrobbles</th>
|
||||||
|
<th scope="col">Complete</th>
|
||||||
|
<th scope="col">Start</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for obj in object_list %}
|
||||||
|
{% if obj.title %}
|
||||||
|
<tr>
|
||||||
|
<td><a href="{{obj.scrobble_set.last.get_absolute_url}}">{{obj.scrobble_set.last.local_timestamp}}
|
||||||
|
<td><a href="{{obj.get_absolute_url}}">{{obj}}</a></td>
|
||||||
|
{% if request.user.is_authenticated %}
|
||||||
|
<td>{{obj.scrobble_count}}</td>
|
||||||
|
<td>{% if obj.scrobble_set.last.logdata.long_play_complete == True %}Yes{% endif %}</td>
|
||||||
|
<td><a type="button" class="btn btn-sm btn-primary" href="{{obj.start_url}}">Scrobble</a></td>
|
||||||
|
{% endif %}
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<p class="pagination">
|
||||||
|
<span class="page-links">
|
||||||
|
{% if page_obj.has_previous %}
|
||||||
|
<a href="?{% urlreplace page=page_obj.previous_page_number %}">prev</a>
|
||||||
|
{% endif %}
|
||||||
|
<span class="page-current">
|
||||||
|
Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}
|
||||||
|
</span>
|
||||||
|
{% if page_obj.has_next %}
|
||||||
|
<a href="?{% urlreplace page=page_obj.next_page_number %}">next</a>
|
||||||
|
{% endif %}
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<div class="col-md">
|
<div class="col-md">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
{% include "_scrobblable_list.html" %}
|
{% include "_longplay_scrobblable_list.html" %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<div class="col-md">
|
<div class="col-md">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
{% include "_scrobblable_list.html" %}
|
{% include "_longplay_scrobblable_list.html" %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<div class="col-md">
|
<div class="col-md">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
{% include "_scrobblable_list.html" %}
|
{% include "_longplay_scrobblable_list.html" %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user