2021-11-08 23:32:13 +01:00
|
|
|
from django.shortcuts import render
|
2021-11-12 18:59:01 +01:00
|
|
|
from django.template.loader import render_to_string
|
|
|
|
from random import randint
|
|
|
|
from django.conf import settings
|
|
|
|
from .models import Talk
|
|
|
|
from asgiref.sync import sync_to_async
|
2021-11-08 23:32:13 +01:00
|
|
|
|
2021-11-12 13:52:41 +01:00
|
|
|
|
|
|
|
def index(request):
|
2021-11-12 18:59:01 +01:00
|
|
|
"""Render layout page"""
|
|
|
|
return render(request, "layouts/base.html", {
|
|
|
|
"room_random": randint(1000000, 9999999),
|
|
|
|
"DOMAIN": settings.DOMAIN,
|
|
|
|
})
|
|
|
|
|
2021-11-12 20:54:20 +01:00
|
|
|
|
2021-11-12 22:16:42 +01:00
|
|
|
def page_talks(page=1):
|
|
|
|
TALK_PER_PAGE = 5
|
|
|
|
return render_to_string("pages/talks.html",
|
|
|
|
{
|
|
|
|
"talks": Talk.objects.order_by("title")[:TALK_PER_PAGE * page],
|
|
|
|
"page": page,
|
|
|
|
"next_page": page + 1,
|
2021-11-12 18:59:01 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
def page_about():
|
|
|
|
return render_to_string("pages/about.html", {})
|