changed random api
This commit is contained in:
parent
6239b8e3e5
commit
0c47170a32
|
@ -4,5 +4,5 @@ from .models import Picture
|
||||||
|
|
||||||
pics=Picture.objects.order_by("?")
|
pics=Picture.objects.order_by("?")
|
||||||
|
|
||||||
def get_random_picture():
|
def get_random_picture_url():
|
||||||
return pics[0].name+".webp"
|
return "https://cdn.clf3.org/tianyi-random/"+pics[0].name+".webp"
|
|
@ -1,6 +1,6 @@
|
||||||
from django.shortcuts import render, redirect
|
from django.shortcuts import render, redirect
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from .random_picture import get_random_picture
|
from .random_picture import get_random_picture_url
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
def index(request):
|
def index(request):
|
||||||
return redirect("https://cdn.clf3.org/tianyi-random/{}".format(get_random_picture()))
|
return redirect(get_random_picture_url())
|
Loading…
Reference in New Issue