diff --git a/home/templates/index.html b/home/templates/index.html
index 9399273..cf229ee 100644
--- a/home/templates/index.html
+++ b/home/templates/index.html
@@ -1,15 +1,20 @@
{% extends 'layouts/base.html' %}
{% block content %}
-
Welcome!
- This site is a work-in-progress database of Idolmaster songs, composers, arrangers, and lyricists.
- The primary purpose of this site is to document the people behind the music in Idolmaster, make observations about the music, and showcase other works that might be of interest
- This site originated from a spreadsheet I maintained to note the composers' works and their similarities.
- Current to-do
-
- - Complete lyricist credits
- - Add songs from IDOLM@STER Radio
- - Re-add other songs that I might have missed
- - Complete showcases of composers
-
+Welcome!
+This site is a work-in-progress database of Idolmaster songs, composers, arrangers, and lyricists.
+The primary purpose of this site is to document the people behind the music in Idolmaster, make observations about
+ the music, and showcase other works that might be of interest
+This site originated from a spreadsheet I maintained to note the composers' works and their similarities.
+Current to-do
+
+ - Complete lyricist credits
+ - Add songs from IDOLM@STER Radio
+ - Re-add other songs that I might have missed
+ - Complete showcases of composers
+
+Mildly interesting
+
{% endblock %}
\ No newline at end of file
diff --git a/home/templates/randomizer.html b/home/templates/randomizer.html
new file mode 100644
index 0000000..5d52e83
--- /dev/null
+++ b/home/templates/randomizer.html
@@ -0,0 +1,32 @@
+{% extends 'layouts/base.html' %}
+
+{% block content %}
+Song Randomizer
+A simple song randomizer.
+WARNING: Very experimental. Implementation is not very smart yet.
+{% if num %}
+Song choice
+
+ {{ song.title }}
+
+
+ View song info
+
+Idols:
+
+ {% for idol in idols %}
+ - {{ idol.romanized_name}} (View idol info)
+ {% endfor %}
+
+{% else %}
+
+
+{% endif %}
+{% endblock %}
\ No newline at end of file
diff --git a/home/urls.py b/home/urls.py
index cd09f95..58d6f59 100644
--- a/home/urls.py
+++ b/home/urls.py
@@ -4,4 +4,5 @@ from . import views
urlpatterns = [
path('',views.index),
+ path('randomizer',views.randomizer),
]
diff --git a/home/views.py b/home/views.py
index a30670b..28c4984 100644
--- a/home/views.py
+++ b/home/views.py
@@ -1,5 +1,21 @@
from django.shortcuts import render
+import random
+from songs.models import Song
+from idols.models import Idol
+
# Create your views here.
def index(request):
- return render(request,"index.html")
\ No newline at end of file
+ return render(request,"index.html")
+
+def randomizer(request):
+ obj = {}
+ if "num" in request.GET:
+ obj['num'] = request.GET['num']
+ song_ids = list(Song.objects.values_list('pk',flat=True))
+ song_id = random.choice(song_ids)
+ obj['song'] = Song.objects.get(pk=song_id)
+ idol_ids = list(Idol.objects.values_list('pk',flat=True))
+ idol_selected_ids = random.sample(idol_ids,int(request.GET['num']))
+ obj['idols'] = Idol.objects.filter(pk__in=idol_selected_ids)
+ return render(request,"randomizer.html",obj)
\ No newline at end of file