2021-07-06 08:53:08 +02:00
|
|
|
from django.contrib.auth.decorators import login_required
|
|
|
|
from django.http import HttpRequest
|
|
|
|
from django.shortcuts import render
|
|
|
|
from django.utils import timezone
|
2022-01-20 12:31:20 +01:00
|
|
|
from django.utils.translation import gettext_lazy as _
|
2021-07-06 08:53:08 +02:00
|
|
|
|
|
|
|
from konova.contexts import BaseContext
|
2022-01-20 12:31:20 +01:00
|
|
|
from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER
|
2021-07-06 08:53:08 +02:00
|
|
|
from news.models import ServerMessage
|
|
|
|
|
|
|
|
|
|
|
|
@login_required
|
|
|
|
def index_view(request: HttpRequest):
|
|
|
|
""" Renders an overview of all news
|
|
|
|
|
|
|
|
Args:
|
|
|
|
request (HttpRequest): The incoming request
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
|
|
"""
|
|
|
|
template = "news/index.html"
|
2023-03-24 07:34:50 +01:00
|
|
|
news = ServerMessage.get_current_news()
|
2021-07-06 08:53:08 +02:00
|
|
|
|
|
|
|
context = {
|
|
|
|
"news": news,
|
2022-01-20 12:31:20 +01:00
|
|
|
TAB_TITLE_IDENTIFIER: _("News"),
|
2021-07-06 08:53:08 +02:00
|
|
|
}
|
|
|
|
context = BaseContext(request, context).context
|
|
|
|
return render(request, template, context)
|