aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/content/views/articles.py
blob: d66425c3372389eabe7ada05dabc97d85531eba7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from django.core.handlers.wsgi import WSGIRequest
from django.http import HttpResponse
from django.shortcuts import render
from django.views import View
from django.views.generic import TemplateView

from pydis_site.apps.content.utils import get_articles, get_categories


class ArticlesView(TemplateView):
    """Shows all content and categories."""

    template_name = "content/articles.html"

    def get_context_data(self, **kwargs):
        """Add articles and categories data to template context."""
        context = super().get_context_data(**kwargs)
        context["content"] = get_articles()
        context["categories"] = get_categories()
        return context