Remove testviews
This commit is contained in:
@@ -1,36 +0,0 @@
|
||||
from typing import List
|
||||
|
||||
from django.http import HttpResponse, HttpRequest
|
||||
|
||||
from . import models
|
||||
|
||||
__all__ = ['index']
|
||||
|
||||
def index(request: HttpRequest) -> HttpResponse:
|
||||
videos = models.Video.objects.all()
|
||||
if videos.count() == 0:
|
||||
video = models.Video(
|
||||
title='Test',
|
||||
slug='test',
|
||||
description='Test object',
|
||||
)
|
||||
video.save()
|
||||
else:
|
||||
video = videos[0]
|
||||
|
||||
if video.transcodings.count() == 0:
|
||||
transcoding = models.Transcoding(video=video, quality='360p', file='somefile')
|
||||
transcoding.save()
|
||||
#transcodings: List[models.Transcoding] = video.transcodings.objects.all()
|
||||
|
||||
videos_html = []
|
||||
for video in videos:
|
||||
videos_html.append(
|
||||
'<li>{title}: {transcodings}</li>'.format(
|
||||
title=video.title,
|
||||
transcodings=', '.join(tr.quality_obj.name for tr in video.transcodings.all()),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
return HttpResponse('<h1>Index!</h1>\n<ul>{videos}</ul>'.format(videos='\n'.join(videos_html)))
|
||||
@@ -19,7 +19,7 @@ from django.conf.urls import url
|
||||
from django.contrib import admin
|
||||
from django.urls import include
|
||||
|
||||
from . import testviews, views
|
||||
from . import views
|
||||
|
||||
_urlpatterns = [
|
||||
url(r'^admin/', admin.site.urls),
|
||||
@@ -29,9 +29,6 @@ _urlpatterns = [
|
||||
|
||||
_urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
for i in testviews.__all__:
|
||||
_urlpatterns.append(url(r'^test/{}$'.format(i), testviews.__dict__[i]))
|
||||
|
||||
if settings.URL_BASE:
|
||||
urlpatterns = [url(r'^{}/'.format(settings.URL_BASE), include(_urlpatterns))]
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user