diff --git a/gawa/blog/templates/blog/browse.html b/gawa/blog/templates/blog/browse.html new file mode 100644 index 0000000..5e4be1e --- /dev/null +++ b/gawa/blog/templates/blog/browse.html @@ -0,0 +1,17 @@ +{% extends 'base.html' %} +{% load i18n %} +{% load helper_tags %} +{% get_current_language as LANGUAGE_CODE %} +{% block languagecode %} + {{ LANGUAGE_CODE }} +{% endblock languagecode %} +{% block title %} + {% translate "cscherr.de" %} - {% translate "Blog" %} +{% endblock title %} +{% block nav %} + {% include 'nav.html' %} +{% endblock nav %} +{% block main %} +
{{ category }}
+ {% include 'blog/featured.html' %} +{% endblock main %} diff --git a/gawa/blog/urls.py b/gawa/blog/urls.py index 45656b5..5d87ab9 100644 --- a/gawa/blog/urls.py +++ b/gawa/blog/urls.py @@ -5,7 +5,6 @@ from . import views app_name: str = "blog" urlpatterns = [ path("", views.Index.as_view(), name="index"), - path("categories", views.CategoryList.as_view(), name="category_list"), - path("", views.ArticleList.as_view(), name="article_list"), + path("browse", views.Browse.as_view(), name="browse"), path("/", views.Post.as_view(), name="post"), ] diff --git a/gawa/blog/views.py b/gawa/blog/views.py index 024c0fc..60dca4b 100644 --- a/gawa/blog/views.py +++ b/gawa/blog/views.py @@ -12,7 +12,7 @@ class Index(TemplateView, SearchableView): """ The index page of the gawa/blog app. - Utilizes a generic view, because I will do so for all views, + Utilizes a generic view, because I will do so for all views, a regular view function would suffice. """ @@ -21,7 +21,6 @@ class Index(TemplateView, SearchableView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['featured_posts'] = BlogPost.objects.filter(featured=True, public=True) - logger.debug(f"loaded featured posts: {context['featured_posts']}") return context class Post(DetailView): @@ -36,25 +35,9 @@ class Post(DetailView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['featured_posts'] = BlogPost.objects.filter(featured=True) - logger.debug(f"loaded featured posts: {context['featured_posts']}") return context -class CategoryList(ListView): - """ - Scroll through a list of blog Categories - """ - - model=Category - template_name = "blog/categories.html" - context_object_name = "categories" - - def get_context_data(self, **kwargs): - context = super().get_context_data(**kwargs) - context['featured_posts'] = BlogPost.objects.filter(featured=True) - logger.debug(f"loaded featured posts: {context['featured_posts']}") - return context - -class ArticleList(ListView): +class Browse(ListView): """ Scroll through a list of blog posts @@ -63,11 +46,10 @@ class ArticleList(ListView): """ model=BlogPost - template_name = "blog/posts.html" + template_name = "blog/browse.html" context_object_name = "posts" def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['featured_posts'] = BlogPost.objects.filter(featured=True) - logger.debug(f"loaded featured posts: {context['featured_posts']}") return context diff --git a/gawa/start/templates/nav.html b/gawa/start/templates/nav.html index 6afe381..186c4c6 100644 --- a/gawa/start/templates/nav.html +++ b/gawa/start/templates/nav.html @@ -29,7 +29,7 @@