blob: 4744299807c75dfecaeb89b6e47ed21a84a5ff9a (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
from django.views.generic.detail import DetailView
from .models import Prompt
class PromptList(DetailView):
model = Prompt
def get_object(self, queryset):
""" This might be faster: random.choice(Prompt.objects.all())"""
return Prompt.objects.order_by('?').first()
|