diff --git a/board/templates/board/home.html b/board/templates/board/home.html new file mode 100644 index 0000000..baac2ec --- /dev/null +++ b/board/templates/board/home.html @@ -0,0 +1,33 @@ +{% extends "board/base.html" %} +{% load i18n %} + +{% block title %}Home {{block.super}}{% endblock title %} + +{% block content %} +
+
 
+

Welcome to interchan!

+
 
+
+ +
+
 
+
+
+

interchan is an experimental image board using a homebrew *chan implementation.

+

Before you post anything, please familiarize yourself with the rules.

+
+

Boards

+ {% for board in boards %} + + {% endfor %} + +

Other links

+ + +
+
 
+
+{% endblock content %} \ No newline at end of file diff --git a/board/templates/board/rules.html b/board/templates/board/rules.html new file mode 100644 index 0000000..497d68b --- /dev/null +++ b/board/templates/board/rules.html @@ -0,0 +1,27 @@ +{% extends "board/base.html" %} +{% load i18n %} + +{% block content %} +
+
 
+

Rules

+
 
+
+ +
+
 
+
+

Boards

+ {% for board in boards %} + + {% endfor %} + +

Other links

+ + +
+
 
+
+{% endblock content %} diff --git a/board/urls.py b/board/urls.py index faad6aa..4a47ef7 100644 --- a/board/urls.py +++ b/board/urls.py @@ -2,13 +2,23 @@ from django.conf import settings from django.conf.urls.static import static from django.urls import path from django.utils.translation import gettext as _ +from django.views.generic.base import TemplateView + from board.views import * app_name = "board" urlpatterns = [ + # Index + path("", HomeView.as_view(), name="home"), # News views - path("news/", NewsListView.as_view(), name="board_news"), + path("news/", NewsListView.as_view(), name="news_list"), + # Rules views + path( + "rules/", + TemplateView.as_view(template_name="board/rules.html"), + name="rules_list", + ), # Reports path("report///", ReportView.as_view(), name="report_form"), path( diff --git a/board/views.py b/board/views.py index bc606cb..ec4a854 100644 --- a/board/views.py +++ b/board/views.py @@ -24,6 +24,7 @@ __all__ = ( "BanSuccessView", "BannedView", "BoardView", + "HomeView", "NewsListView", "PostCreateView", "PostModifyView", @@ -48,6 +49,15 @@ def can_modify(user): ) +class HomeView(TemplateView): + template_name = "board/home.html" + + def get_context_data(self, **kwargs: Any) -> Dict[str, Any]: + context = super().get_context_data(**kwargs) + context["boards"] = Board.objects.filter(readonly=False) + return context + + class ActionSuccessView(TemplateView): template_name = "board/action_success.html" message = "Action completed."