Stub in sports urls
This commit is contained in:
18
vrobbler/apps/sports/urls.py
Normal file
18
vrobbler/apps/sports/urls.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
from django.urls import path
|
||||||
|
from sports import views
|
||||||
|
|
||||||
|
app_name = 'sports'
|
||||||
|
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path(
|
||||||
|
'sport-events/',
|
||||||
|
views.SportEventListView.as_view(),
|
||||||
|
name='event_list',
|
||||||
|
),
|
||||||
|
path(
|
||||||
|
'sport-events/<slug:slug>/',
|
||||||
|
views.SportEventDetailView.as_view(),
|
||||||
|
name='event_detail',
|
||||||
|
),
|
||||||
|
]
|
||||||
12
vrobbler/apps/sports/views.py
Normal file
12
vrobbler/apps/sports/views.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
from django.views import generic
|
||||||
|
from sports.models import SportEvent
|
||||||
|
|
||||||
|
|
||||||
|
class SportEventListView(generic.ListView):
|
||||||
|
model = SportEvent
|
||||||
|
paginate_by = 50
|
||||||
|
|
||||||
|
|
||||||
|
class SportEventDetailView(generic.DetailView):
|
||||||
|
model = SportEvent
|
||||||
|
slug_field = 'uuid'
|
||||||
33
vrobbler/templates/sports/sportevent_detail.html
Normal file
33
vrobbler/templates/sports/sportevent_detail.html
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
{% extends "base_detail.html" %}
|
||||||
|
|
||||||
|
{% block title %}{{object.title}} - {{object.round.season.league}}{% endblock %}
|
||||||
|
|
||||||
|
{% block details %}
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<h2>{{object.tv_series}}</h2>
|
||||||
|
<div class="col-md">
|
||||||
|
<h3>Last scrobbles</h3>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped table-sm">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Date</th>
|
||||||
|
<th scope="col">Season</th>
|
||||||
|
<th scope="col">League</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for scrobble in object.scrobble_set.all %}
|
||||||
|
<tr>
|
||||||
|
<td>{{scrobble.timestamp}}</td>
|
||||||
|
<td>{{scrobble.media_obj.round.season.name}}</td>
|
||||||
|
<td>{{scrobble.media_obj.round.season.league}}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
36
vrobbler/templates/sports/sportevent_list.html
Normal file
36
vrobbler/templates/sports/sportevent_list.html
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
{% extends "base_list.html" %}
|
||||||
|
|
||||||
|
{% block title %}Sport events{% endblock %}
|
||||||
|
|
||||||
|
{% block lists %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped table-sm">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Title</th>
|
||||||
|
<th scope="col">Date</th>
|
||||||
|
<th scope="col">Round</th>
|
||||||
|
<th scope="col">League</th>
|
||||||
|
<th scope="col">Scrobbles</th>
|
||||||
|
<th scope="col">All time</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for obj in object_list %}
|
||||||
|
<tr>
|
||||||
|
<td><a href="{{obj.get_absolute_url}}">{{obj.title}}</a></td>
|
||||||
|
<td>{{obj.start}}</td>
|
||||||
|
<td>{{obj.round.name}}</td>
|
||||||
|
<td>{{obj.round.league}}</td>
|
||||||
|
<td>{{obj.scrobble_set.count}}</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@ -5,6 +5,7 @@ from rest_framework import routers
|
|||||||
import vrobbler.apps.scrobbles.views as scrobbles_views
|
import vrobbler.apps.scrobbles.views as scrobbles_views
|
||||||
from vrobbler.apps.books.api.views import AuthorViewSet, BookViewSet
|
from vrobbler.apps.books.api.views import AuthorViewSet, BookViewSet
|
||||||
from vrobbler.apps.music import urls as music_urls
|
from vrobbler.apps.music import urls as music_urls
|
||||||
|
from vrobbler.apps.sports import urls as sports_urls
|
||||||
from vrobbler.apps.music.api.views import (
|
from vrobbler.apps.music.api.views import (
|
||||||
AlbumViewSet,
|
AlbumViewSet,
|
||||||
ArtistViewSet,
|
ArtistViewSet,
|
||||||
@ -57,6 +58,7 @@ urlpatterns = [
|
|||||||
path("accounts/", include("allauth.urls")),
|
path("accounts/", include("allauth.urls")),
|
||||||
path("", include(music_urls, namespace="music")),
|
path("", include(music_urls, namespace="music")),
|
||||||
path("", include(video_urls, namespace="videos")),
|
path("", include(video_urls, namespace="videos")),
|
||||||
|
path("", include(sports_urls, namespace="sports")),
|
||||||
path("", include(scrobble_urls, namespace="scrobbles")),
|
path("", include(scrobble_urls, namespace="scrobbles")),
|
||||||
path(
|
path(
|
||||||
"", scrobbles_views.RecentScrobbleList.as_view(), name="vrobbler-home"
|
"", scrobbles_views.RecentScrobbleList.as_view(), name="vrobbler-home"
|
||||||
|
|||||||
Reference in New Issue
Block a user