Refactoring
This commit is contained in:
parent
95d5aa6992
commit
19dc4b5b64
|
|
@ -1,8 +1,8 @@
|
|||
from django.db.models import Q
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.decorators import api_view
|
||||
from core.models import Video
|
||||
from core.serializers import VideoSerializer
|
||||
from django.db.models import Q
|
||||
|
||||
@api_view(['GET'])
|
||||
def videoAPI(request):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -22,8 +22,6 @@ urlpatterns = [
|
|||
path('admin/', admin.site.urls),
|
||||
path('auth/', include('django.contrib.auth.urls')),
|
||||
path('', include('core.urls')),
|
||||
#path('/', include('core.urls')),
|
||||
#path('status/', include('core.urls')),
|
||||
path('api/', include('api.urls')),
|
||||
]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user