summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/posts/build.py4
-rw-r--r--app/posts/models.py6
-rw-r--r--app/posts/templates/posts/essay_detail.html (renamed from app/posts/templates/posts/note_detail.html)0
-rw-r--r--app/posts/templates/posts/essay_list.html (renamed from app/posts/templates/posts/note_list.html)8
-rw-r--r--app/posts/urls/essay_urls.py (renamed from app/posts/urls/notes_urls.py)12
-rw-r--r--app/posts/views/essay_views.py54
-rw-r--r--app/posts/views/guide_views.py42
7 files changed, 69 insertions, 57 deletions
diff --git a/app/posts/build.py b/app/posts/build.py
index 8b4cee2..b49b925 100644
--- a/app/posts/build.py
+++ b/app/posts/build.py
@@ -114,11 +114,11 @@ class BuildJrnl(BuildNew):
class BuildEssays(BuildNew):
def get_model_queryset(self):
- return self.model.objects.filter(post_type=PostType.NOTE).filter(status__exact=1).order_by('-pub_date')
+ return self.model.objects.filter(post_type=PostType.ESSAY).filter(status__exact=1).order_by('-pub_date')
def build(self):
self.build_list_view(
- base_path=reverse("notes:list"),
+ base_path=reverse("essay-list:list"),
paginate_by=50
)
self.build_detail_view()
diff --git a/app/posts/models.py b/app/posts/models.py
index 2cf17b7..9697f27 100644
--- a/app/posts/models.py
+++ b/app/posts/models.py
@@ -41,7 +41,7 @@ def get_upload_path(self, filename):
class PostType(models.IntegerChoices):
RANGE = 0, ('range')
REVIEW = 1, ('review')
- NOTE = 2, ('note')
+ ESSAY = 2, ('essay')
SRC = 3, ('src')
JRNL = 4, ('jrnl')
FIELD_NOTE = 5, ('field note')
@@ -104,8 +104,8 @@ class Post(models.Model):
return self.title
def get_absolute_url(self):
- if self.post_type == PostType.NOTE:
- return reverse('notes:detail', kwargs={"slug": self.slug})
+ if self.post_type == PostType.ESSAY:
+ return reverse('essays:detail', kwargs={"slug": self.slug})
if self.post_type == PostType.RANGE:
m = NewsletterMailing.objects.get(post__id=self.pk)
return reverse('range:range-detail', kwargs={"issue": m.get_issue_str(), "slug": self.slug})
diff --git a/app/posts/templates/posts/note_detail.html b/app/posts/templates/posts/essay_detail.html
index 455a024..455a024 100644
--- a/app/posts/templates/posts/note_detail.html
+++ b/app/posts/templates/posts/essay_detail.html
diff --git a/app/posts/templates/posts/note_list.html b/app/posts/templates/posts/essay_list.html
index 559933c..6c9820d 100644
--- a/app/posts/templates/posts/note_list.html
+++ b/app/posts/templates/posts/essay_list.html
@@ -1,13 +1,13 @@
{% extends 'base.html' %}
{% load typogrify_tags %}
-{% block pagetitle %}Notes On Living - By Scott Gilbertson {% endblock %}
-{% block metadescription %}Musings and stories on self-reliance, DIY ethics, repair, living well, Gods, stoicism, tools, walking and other ephemera.{% endblock %}
+{% block pagetitle %}Notes and Essays On Living - By Scott Gilbertson {% endblock %}
+{% block metadescription %}Essays and stories on self-reliance, DIY, repair, tools, birding, walking, living well, and other ephemera.{% endblock %}
{% block breadcrumbs %}{% if breadcrumbs %}{% include "lib/breadcrumbs.html" with breadcrumbs=breadcrumbs %}{%endif%}{% endblock %}
{% block primary %}<main class="archive-wrapper">
<div class="archive-intro">
- <h1 class="archive-sans">Notes</h1>
+ <h1 class="archive-sans">Notes &amp; Essays</h1>
<p><em>Être fort pour être utile</em></p>
- <p>Some of the essays below have appeared elsewhere, but they live here now, along with all the newer stuff. Please feel free to email me or leave a comment, I'd love to hear your thoughts on the ideas explored here. Otherwise, please enjoy.</p>
+ <p>Essays and stories on self-reliance, DIY, repair, tools, birding, walking, living well, and other bric-à-brac. Please, enjoy.</p>
</div>
<ul class="archive-list">{% for object in object_list %}
<li class="h-entry hentry archive-list-card archive-list-card-sm" itemscope itemType="http://schema.org/Article">
diff --git a/app/posts/urls/notes_urls.py b/app/posts/urls/essay_urls.py
index 6fb9fa1..7eb872d 100644
--- a/app/posts/urls/notes_urls.py
+++ b/app/posts/urls/essay_urls.py
@@ -1,28 +1,28 @@
from django.urls import path, re_path
-from ..views import guide_views as views
+from ..views import essay_views as views
-app_name = "notes"
+app_name = "essays"
urlpatterns = [
path(
r'<str:slug>',
- views.PostDetailView.as_view(),
+ views.EssayDetailView.as_view(),
name="detail"
),
path(
r'<str:slug>.txt',
- views.PostDetailViewTXT.as_view(),
+ views.EssayDetailViewTXT.as_view(),
name="detail-txt"
),
path(
r'<int:page>/',
- views.NotesListView.as_view(),
+ views.EssayListView.as_view(),
name="list"
),
path(
r'',
- views.NotesListView.as_view(),
+ views.EssayListView.as_view(),
{'page':1},
name="list"
),
diff --git a/app/posts/views/essay_views.py b/app/posts/views/essay_views.py
new file mode 100644
index 0000000..ca1697f
--- /dev/null
+++ b/app/posts/views/essay_views.py
@@ -0,0 +1,54 @@
+from django.views.generic import ListView
+from django.views.generic.detail import DetailView
+from django.contrib.syndication.views import Feed
+from django.apps import apps
+from django.conf import settings
+
+from utils.views import PaginatedListView, LuxDetailView
+
+from ..models import Post, PostType
+from taxonomy.models import Category
+
+
+class EssayListView(PaginatedListView):
+ model = Post
+ template_name = "posts/essay_list.html"
+
+ def get_queryset(self):
+ queryset = super(EssayListView, self).get_queryset()
+ return queryset.filter(site__domain='luxagraf.net').filter(post_type__in=[PostType.ESSAY]).filter(status__exact=1).order_by('-pub_date').prefetch_related('location').prefetch_related('featured_image')
+
+ def get_context_data(self, **kwargs):
+ '''
+ override for custom breadcrumb path
+ '''
+ # Call the base implementation first to get a context
+ context = super(EssayListView, self).get_context_data(**kwargs)
+ context['breadcrumbs'] = ('Essay',)
+ return context
+
+
+class EssayDetailView(LuxDetailView):
+ model = Post
+ slug_field = "slug"
+
+ def get_queryset(self):
+ queryset = super(EssayDetailView, self).get_queryset()
+ return queryset.select_related('location').prefetch_related('field_notes')
+
+ def get_context_data(self, **kwargs):
+ context = super(EssayDetailView, self).get_context_data(**kwargs)
+ related = []
+ for obj in self.object.related.all():
+ model = apps.get_model(obj.model_name.app_label, obj.model_name.model)
+ related.append(model.objects.get(slug=obj.slug, pub_date=obj.pub_date))
+ context['related'] = related
+ return context
+
+ def get_template_names(self):
+ obj = self.get_object()
+ return ["posts/essay_detail.html"]
+
+
+class EssayDetailViewTXT(EssayDetailView):
+ template_name = "posts/entry_detail.txt"
diff --git a/app/posts/views/guide_views.py b/app/posts/views/guide_views.py
index c5fdd55..346fcc7 100644
--- a/app/posts/views/guide_views.py
+++ b/app/posts/views/guide_views.py
@@ -58,48 +58,6 @@ class ReviewsListView(GuideListView):
return context
-class NotesListView(PaginatedListView):
- model = Post
- template_name = "posts/note_list.html"
-
- def get_queryset(self):
- queryset = super(NotesListView, self).get_queryset()
- return queryset.filter(site__domain='luxagraf.net').filter(post_type__in=[PostType.NOTE]).filter(status__exact=1).order_by('-pub_date').prefetch_related('location').prefetch_related('featured_image')
-
- def get_context_data(self, **kwargs):
- '''
- override for custom breadcrumb path
- '''
- # Call the base implementation first to get a context
- context = super(NotesListView, self).get_context_data(**kwargs)
- context['breadcrumbs'] = ('Notes',)
- return context
-
-
-
-class NoteDetailView(LuxDetailView):
- model = Post
- slug_field = "slug"
-
- def get_queryset(self):
- queryset = super(EssayDetailView, self).get_queryset()
- return queryset.select_related('location').prefetch_related('field_notes')
-
- def get_context_data(self, **kwargs):
- context = super(EssayDetailView, self).get_context_data(**kwargs)
- related = []
- for obj in self.object.related.all():
- model = apps.get_model(obj.model_name.app_label, obj.model_name.model)
- related.append(model.objects.get(slug=obj.slug, pub_date=obj.pub_date))
- context['related'] = related
- return context
-
- def get_template_names(self):
- obj = self.get_object()
- return ["posts/%s_detail.html" % obj.get_post_type_display(), 'posts/post_detail.html']
-
-
-
class PostDetailView(LuxDetailView):
model = Post
slug_field = "slug"