17 lines
504 B
Python
17 lines
504 B
Python
import json
|
|
import random
|
|
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"
|
|
def get_random_picture_meta():
|
|
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
|
|
} |