Playlist maker wip

This commit is contained in:
2024-07-17 21:21:26 +02:00
parent cef5ee3d8a
commit 8a7ae9c2f9
3 changed files with 15 additions and 3 deletions
@@ -1,7 +1,7 @@
{% extends "Base.html" %} {% extends "Base.html" %}
{% block window-title %} {% block window-title %}
Nomineren Playlist -
{% endblock %} {% endblock %}
{% block main-content %} {% block main-content %}
+9
View File
@@ -0,0 +1,9 @@
{% extends "Base.html" %}
{% block window-title %}
Overzicht - Playlists
{% endblock %}
{% block main-content %}
{% endblock %}
+5 -2
View File
@@ -7,7 +7,7 @@ from django.db.models import Avg
from django.urls import reverse from django.urls import reverse
import re import re
from collections import OrderedDict from collections import OrderedDict
from .models import Track, Artist, Album, Vote, Background, Profile from .models import Track, Artist, Album, Vote, Background, Profile, Playlist
from .utils import from_json, get_unvoted from .utils import from_json, get_unvoted
from .spotify import spt from .spotify import spt
from .tasks import get_banter, get_and_dither_image from .tasks import get_banter, get_and_dither_image
@@ -201,12 +201,15 @@ class OverView(LoginRequiredMixin, View):
class PlaylistListView(LoginRequiredMixin, View): class PlaylistListView(LoginRequiredMixin, View):
def get(self, request, count=None): def get(self, request, count=None):
context = {
"playlists": Playlist.objects.all()
}
return TemplateResponse(request, "PlaylistList.html", context) return TemplateResponse(request, "PlaylistList.html", context)
def post(self, request): def post(self, request):
name = self.request.POST.get('name', None) name = self.request.POST.get('name', None)
if name: if name:
new_playlist = Playlist(name=name) new_playlist = Playlist(name=name)
return TemplateResponse(request, "PlaylistList.html", context) return TemplateResponse(request, "PlaylistList.html")
return self.get(request, count=count) return self.get(request, count=count)