This commit is contained in:
mdecker62
2026-02-25 18:12:30 -05:00
parent 8026902872
commit aa8685d85f
4 changed files with 551 additions and 654 deletions

View File

@@ -37,5 +37,32 @@ def guess_answer(params):
}
except Riddle.DoesNotExist:
raise NotFound("Riddle not found")
@route_get('lines/random', args={})
def random_line(params):
line = Line.objects.random()
if not line:
raise NotFound("No lines found")
return {"line": str(line)}
@route_get('lines/short', args={})
def short_line(params):
line = Line.objects.filter(clean_text__length__lt=40).random()
if not line:
raise NotFound("No short line found")
return {"line": str(line)}
@route_get('lines/about', args={'topic': str})
def line_about(params):
topic = params['topic']
line = Line.objects.filter(clean_text__icontains=topic).random()
if not line:
raise NotFound("No line found containing that topic")
return {
"line": str(line),
"topic": topic
}