diff --git a/backend/randpic/random_picture.py b/backend/randpic/random_picture.py index 9d4d7ed..7397156 100644 --- a/backend/randpic/random_picture.py +++ b/backend/randpic/random_picture.py @@ -5,13 +5,15 @@ from .models import Picture pics=Picture.objects.order_by("?") def get_random_picture_url(): - return "https://cdn.clf3.org/tianyi-random/"+pics[0].name+".webp" + selected_pic=pics[0] + return "https://cdn.clf3.org/tianyi-random/"+selected_pic.name+".webp" def get_random_picture_meta(): + selected_pic=pics[0] return { - "name":pics[0].name, - "url":"https://cdn.clf3.org/tianyi-random/"+pics[0].name+".webp", - "description":pics[0].description, - "author":pics[0].author, - "author_url":pics[0].author_url, - "original_url":pics[0].original_url + "name":selected_pic.name, + "url":"https://cdn.clf3.org/tianyi-random/"+selected_pic.name+".webp", + "description":selected_pic.description, + "author":selected_pic.author, + "author_url":selected_pic.author_url, + "original_url":selected_pic.original_url } \ No newline at end of file