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
+5 -2
View File
@@ -7,7 +7,7 @@ from django.db.models import Avg
from django.urls import reverse
import re
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 .spotify import spt
from .tasks import get_banter, get_and_dither_image
@@ -201,12 +201,15 @@ class OverView(LoginRequiredMixin, View):
class PlaylistListView(LoginRequiredMixin, View):
def get(self, request, count=None):
context = {
"playlists": Playlist.objects.all()
}
return TemplateResponse(request, "PlaylistList.html", context)
def post(self, request):
name = self.request.POST.get('name', None)
if name:
new_playlist = Playlist(name=name)
return TemplateResponse(request, "PlaylistList.html", context)
return TemplateResponse(request, "PlaylistList.html")
return self.get(request, count=count)