bug fix: return the same pic's info
This commit is contained in:
parent
51986a13bd
commit
d2238c2cb2
|
@ -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
|
||||
}
|
Loading…
Reference in New Issue