generated from mwc/lab_server
fixed some backend bugs, did about, not done
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user