Compare commits
No commits in common. "19dc4b5b64026a1c48e2bea1026ab759f2d4255e" and "0ac29fd7d58c7adfe155cda02d32f0e71244231c" have entirely different histories.
19dc4b5b64
...
0ac29fd7d5
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -2,5 +2,3 @@ db.sqlite3
|
||||||
videos/
|
videos/
|
||||||
channel_archiver/yt-dlp-archive.txt
|
channel_archiver/yt-dlp-archive.txt
|
||||||
channel_archiver/UnusualVideos*
|
channel_archiver/UnusualVideos*
|
||||||
*__pycache__*
|
|
||||||
*.pyc
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
from django.urls import path
|
|
||||||
from . import views
|
|
||||||
|
|
||||||
urlpatterns = [
|
|
||||||
path('', views.videoAPI),
|
|
||||||
]
|
|
||||||
12
api/views.py
12
api/views.py
|
|
@ -1,12 +0,0 @@
|
||||||
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
|
|
||||||
|
|
||||||
@api_view(['GET'])
|
|
||||||
def videoAPI(request):
|
|
||||||
q = request.GET.get('q', '')
|
|
||||||
videos = Video.objects.filter(Q(id__contains=q) | Q(name__contains=q))
|
|
||||||
serializer = VideoSerializer(videos, many=True)
|
|
||||||
return Response(serializer.data)
|
|
||||||
BIN
core/__pycache__/__init__.cpython-38.pyc
Normal file
BIN
core/__pycache__/__init__.cpython-38.pyc
Normal file
Binary file not shown.
BIN
core/__pycache__/admin.cpython-38.pyc
Normal file
BIN
core/__pycache__/admin.cpython-38.pyc
Normal file
Binary file not shown.
BIN
core/__pycache__/apps.cpython-38.pyc
Normal file
BIN
core/__pycache__/apps.cpython-38.pyc
Normal file
Binary file not shown.
BIN
core/__pycache__/models.cpython-38.pyc
Normal file
BIN
core/__pycache__/models.cpython-38.pyc
Normal file
Binary file not shown.
BIN
core/__pycache__/urls.cpython-38.pyc
Normal file
BIN
core/__pycache__/urls.cpython-38.pyc
Normal file
Binary file not shown.
BIN
core/__pycache__/views.cpython-38.pyc
Normal file
BIN
core/__pycache__/views.cpython-38.pyc
Normal file
Binary file not shown.
|
|
@ -1,4 +1,6 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
|
|
||||||
from .models import Video
|
from .models import Video
|
||||||
|
|
||||||
@admin.register(Video)
|
@admin.register(Video)
|
||||||
|
|
|
||||||
BIN
core/migrations/__pycache__/0001_initial.cpython-38.pyc
Normal file
BIN
core/migrations/__pycache__/0001_initial.cpython-38.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
core/migrations/__pycache__/__init__.cpython-38.pyc
Normal file
BIN
core/migrations/__pycache__/__init__.cpython-38.pyc
Normal file
Binary file not shown.
|
|
@ -1,7 +0,0 @@
|
||||||
from rest_framework import serializers
|
|
||||||
from .models import Video
|
|
||||||
|
|
||||||
class VideoSerializer(serializers.ModelSerializer):
|
|
||||||
class Meta:
|
|
||||||
model = Video
|
|
||||||
fields = ['id', 'name']
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', views.core, name='core'),
|
path('', views.core, name='core'),
|
||||||
path('status/', views.status, name='status'),
|
path('status/', views.status, name='status'),
|
||||||
path('about/', views.about, name='about'),
|
path('about/', views.about, name='about'),
|
||||||
path('random/', views.random, name='random'),
|
path('random/', views.random, name='random'),
|
||||||
path('view/<int:id>', views.view, name='view'),
|
path('view/<int:id>', views.view, name='view'),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
|
from django.http import HttpResponse
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
from core.models import Video
|
from core.models import Video
|
||||||
|
import random
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
||||||
|
|
@ -8,9 +11,10 @@ def core(request):
|
||||||
videos = Video.objects.all()
|
videos = Video.objects.all()
|
||||||
return render(request, 'base.html', {'videos': videos[::-1]})
|
return render(request, 'base.html', {'videos': videos[::-1]})
|
||||||
|
|
||||||
|
|
||||||
def random(request):
|
def random(request):
|
||||||
videos = Video.objects.all().order_by("?")
|
videos = Video.objects.all().order_by("?")
|
||||||
ran = videos.first()
|
ran = videos.first();
|
||||||
return redirect('/view/'+str(ran.id))
|
return redirect('/view/'+str(ran.id))
|
||||||
|
|
||||||
def status(request):
|
def status(request):
|
||||||
|
|
|
||||||
BIN
ragnarok/__pycache__/__init__.cpython-38.pyc
Normal file
BIN
ragnarok/__pycache__/__init__.cpython-38.pyc
Normal file
Binary file not shown.
BIN
ragnarok/__pycache__/settings.cpython-38.pyc
Normal file
BIN
ragnarok/__pycache__/settings.cpython-38.pyc
Normal file
Binary file not shown.
BIN
ragnarok/__pycache__/urls.cpython-38.pyc
Normal file
BIN
ragnarok/__pycache__/urls.cpython-38.pyc
Normal file
Binary file not shown.
BIN
ragnarok/__pycache__/wsgi.cpython-38.pyc
Normal file
BIN
ragnarok/__pycache__/wsgi.cpython-38.pyc
Normal file
Binary file not shown.
|
|
@ -40,7 +40,7 @@ INSTALLED_APPS = [
|
||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'rest_framework',
|
'rest_framework',
|
||||||
#'sage_stream',
|
'sage_stream',
|
||||||
'core'
|
'core'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,9 @@ urlpatterns = [
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
path('auth/', include('django.contrib.auth.urls')),
|
path('auth/', include('django.contrib.auth.urls')),
|
||||||
path('', include('core.urls')),
|
path('', include('core.urls')),
|
||||||
path('api/', include('api.urls')),
|
path('/', include('core.urls')),
|
||||||
|
path('status/', include('core.urls')),
|
||||||
|
path('api/', include('sage_stream.api.urls')),
|
||||||
]
|
]
|
||||||
|
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user