aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/content/views
diff options
context:
space:
mode:
Diffstat (limited to 'pydis_site/apps/content/views')
-rw-r--r--pydis_site/apps/content/views/__init__.py6
-rw-r--r--pydis_site/apps/content/views/page_category.py (renamed from pydis_site/apps/content/views/article_category.py)20
-rw-r--r--pydis_site/apps/content/views/pages.py (renamed from pydis_site/apps/content/views/articles.py)10
3 files changed, 18 insertions, 18 deletions
diff --git a/pydis_site/apps/content/views/__init__.py b/pydis_site/apps/content/views/__init__.py
index f92660d6..740d98e9 100644
--- a/pydis_site/apps/content/views/__init__.py
+++ b/pydis_site/apps/content/views/__init__.py
@@ -1,4 +1,4 @@
-from .article_category import ArticleOrCategoryView
-from .articles import ArticlesView
+from .page_category import PageOrCategoryView
+from .pages import PagesView
-__all__ = ["ArticleOrCategoryView", "ArticlesView"]
+__all__ = ["PageOrCategoryView", "PagesView"]
diff --git a/pydis_site/apps/content/views/article_category.py b/pydis_site/apps/content/views/page_category.py
index 2a407b99..f00a79ee 100644
--- a/pydis_site/apps/content/views/article_category.py
+++ b/pydis_site/apps/content/views/page_category.py
@@ -7,18 +7,18 @@ from django.views.generic import TemplateView
from pydis_site.apps.content import utils
-class ArticleOrCategoryView(TemplateView):
- """Handles article and category pages."""
+class PageOrCategoryView(TemplateView):
+ """Handles pages and page categories."""
def get_template_names(self) -> t.List[str]:
- """Checks does this use article template or listing template."""
+ """Checks does this use page template or listing template."""
location = self.kwargs["location"].split("/")
- full_location = settings.ARTICLES_PATH.joinpath(*location)
+ full_location = settings.PAGES_PATH.joinpath(*location)
if full_location.is_dir():
template_name = "content/listing.html"
elif full_location.with_suffix(".md").is_file():
- template_name = "content/article.html"
+ template_name = "content/page.html"
else:
raise Http404
@@ -29,17 +29,17 @@ class ArticleOrCategoryView(TemplateView):
context = super().get_context_data(**kwargs)
location: list = self.kwargs["location"].split("/")
- full_location = settings.ARTICLES_PATH.joinpath(*location)
+ full_location = settings.PAGES_PATH.joinpath(*location)
if full_location.is_dir():
context["category_info"] = utils.get_category(location)
- context["content"] = utils.get_articles(location)
+ context["content"] = utils.get_pages(location)
context["categories"] = utils.get_categories(location)
# Add trailing slash here to simplify template
context["path"] = "/".join(location) + "/"
context["in_category"] = True
elif full_location.with_suffix(".md").is_file():
- article_result = utils.get_article(location)
+ page_result = utils.get_page(location)
if len(location) > 1:
context["category_data"] = utils.get_category(location[:-1])
@@ -47,8 +47,8 @@ class ArticleOrCategoryView(TemplateView):
else:
context["category_data"] = {"name": None, "raw_name": None}
- context["article"] = article_result
- context["relevant_links"] = article_result["metadata"].get("relevant_links", {})
+ context["page"] = page_result
+ context["relevant_links"] = page_result["metadata"].get("relevant_links", {})
else:
raise Http404
diff --git a/pydis_site/apps/content/views/articles.py b/pydis_site/apps/content/views/pages.py
index 999002d0..11ac0eeb 100644
--- a/pydis_site/apps/content/views/articles.py
+++ b/pydis_site/apps/content/views/pages.py
@@ -1,16 +1,16 @@
from django.views.generic import TemplateView
-from pydis_site.apps.content.utils import get_articles, get_categories
+from pydis_site.apps.content.utils import get_pages, get_categories
-class ArticlesView(TemplateView):
- """Shows all content and categories."""
+class PagesView(TemplateView):
+ """Shows all pages and categories."""
template_name = "content/listing.html"
def get_context_data(self, **kwargs) -> dict:
- """Add articles and categories data to template context."""
+ """Add page and category data to template context."""
context = super().get_context_data(**kwargs)
- context["content"] = get_articles()
+ context["content"] = get_pages()
context["categories"] = get_categories()
return context