Refactoring

This commit is contained in:
david
2023-05-19 01:33:35 +02:00
parent 95d5aa6992
commit 19dc4b5b64
3 changed files with 2 additions and 8 deletions

View File

@@ -1,9 +1,6 @@
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.shortcuts import redirect
from core.models import Video
import random
# Create your views here.
@@ -11,10 +8,9 @@ def core(request):
videos = Video.objects.all()
return render(request, 'base.html', {'videos': videos[::-1]})
def random(request):
videos = Video.objects.all().order_by("?")
ran = videos.first();
ran = videos.first()
return redirect('/view/'+str(ran.id))
def status(request):