diff --git a/videodinges/templates/index.html.j2 b/videodinges/templates/index.html.j2 new file mode 100644 index 0000000..df10823 --- /dev/null +++ b/videodinges/templates/index.html.j2 @@ -0,0 +1,10 @@ + + +

Video's

+ + + \ No newline at end of file diff --git a/videodinges/urls.py b/videodinges/urls.py index 16fac84..9ae9eee 100644 --- a/videodinges/urls.py +++ b/videodinges/urls.py @@ -22,6 +22,7 @@ from . import testviews, views urlpatterns = [ url(r'^admin/', admin.site.urls), + url(r'^$', views.index), url(r'^(?P[\w-]+).html', views.video) ] diff --git a/videodinges/views.py b/videodinges/views.py index 43cffb2..39bad45 100644 --- a/videodinges/views.py +++ b/videodinges/views.py @@ -53,6 +53,10 @@ def video(request: HttpRequest, slug: str) -> HttpResponse: return render(request, 'video.html.j2', template_data, using='jinja2') +def index(request: HttpRequest) -> HttpResponse: + videos = models.Video.objects.order_by('-created_at').all() + return render(request, 'index.html.j2', dict(videos=videos), using='jinja2') + def _get_dict_from_models_with_fields(model, *fields: str) -> Dict[str, Any]: ret = {} for field in fields: