1 from django.views.generic import TemplateView, DetailView
2 from .models import Word
4 class HomeView(TemplateView):
5 template_name = 'words/home.html'
7 def get_context_data(self):
8 all_words = Word.objects.all().order_by('word')
10 for word in all_words:
11 words.setdefault(word.alignment, []).append(word)
15 #'random': Word.objects.order_by('?')[0],
18 class WordView(DetailView):
21 def get_context_data(self, object):
24 'words': Word.objects.all(),