TianyiMoe/backend/randpic/views.py

9 lines
394 B
Python
Raw Permalink Normal View History

2024-04-27 07:50:22 +00:00
from django.shortcuts import render, redirect
from django.http import HttpResponse
2024-04-30 05:40:39 +00:00
from .random_picture import get_random_picture_url, get_random_picture_meta
import json
2024-04-27 07:50:22 +00:00
# Create your views here.
2024-04-30 09:24:03 +00:00
def redirect_view(request):
2024-04-30 05:40:39 +00:00
return redirect(get_random_picture_url())
2024-04-30 09:24:03 +00:00
def metadata_view(request):
2024-04-30 05:40:39 +00:00
return HttpResponse(json.dumps(get_random_picture_meta()), content_type="application/json")