stroopwafel eindpunt
This commit is contained in:
@@ -14,5 +14,6 @@ urlpatterns = [
|
|||||||
path('overview/playlist', views.PlaylistListView.as_view(), name="playlist-list"),
|
path('overview/playlist', views.PlaylistListView.as_view(), name="playlist-list"),
|
||||||
path('overview/playlist/<int:id>', views.PlaylistDetailView.as_view(), name="playlist-detail"),
|
path('overview/playlist/<int:id>', views.PlaylistDetailView.as_view(), name="playlist-detail"),
|
||||||
path('spotify/callback', views.SpotifyCallbackView.as_view(), name="spotify-callback"),
|
path('spotify/callback', views.SpotifyCallbackView.as_view(), name="spotify-callback"),
|
||||||
|
path('stroopwafel', views.StroopwafelView.as_view(), name="stroopwafel"),
|
||||||
path('', views.AuthView.as_view()),
|
path('', views.AuthView.as_view()),
|
||||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
|
|||||||
+13
-1
@@ -1,6 +1,6 @@
|
|||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.views import View
|
from django.views import View
|
||||||
from django.http import HttpResponse, HttpResponseRedirect
|
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
|
||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.db.models import Avg
|
from django.db.models import Avg
|
||||||
@@ -288,3 +288,15 @@ class PlaylistImportView(LoginRequiredMixin, View):
|
|||||||
print(e)
|
print(e)
|
||||||
|
|
||||||
return self.get(request)
|
return self.get(request)
|
||||||
|
|
||||||
|
class StroopwafelView(View):
|
||||||
|
def get(self, request):
|
||||||
|
nominated_count = Track.objects.all().count()
|
||||||
|
return JsonResponse(
|
||||||
|
{
|
||||||
|
"openDate": os.getenv('DATE_OPEN'),
|
||||||
|
"deadlineNominations": os.getenv('DATE_NOM_END'),
|
||||||
|
"deadlineVoting": os.getenv('DATE_VOTE_END'),
|
||||||
|
"stemCount": nominated_count
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user