fixed some backend bugs, did about, not done

This commit is contained in:
owengavi2
2026-03-10 19:03:51 -04:00
parent 4d4db3714d
commit c50c0fcc81
4 changed files with 540 additions and 1 deletions

View File

@@ -6,3 +6,15 @@ from random import choice, sample
@route_get('lines/random', args={})
def get_random_line(params):
return {'line': Line.objects.random().text}
@route_get('lines/about', args={'topic': str})
def get_about_line(params):
word = params['topic']
if not Line.objects.filter(clean_text__contains=word):
raise NotFound("no line with that topic")
line = Line.objects.filter(clean_text__contains=word).random()
retval = {'line': line.text, 'topic' : word}
return retval