diff options
author | luxagraf <sng@luxagraf.net> | 2024-05-10 14:57:18 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2024-05-10 14:57:18 -0500 |
commit | 0031ea3b8feea6612a9d37212f350c623ff3b902 (patch) | |
tree | 246f38971a94a996a24572097196e7e175fbb690 | |
parent | 0166afd8377ebb565ae0b8310d1d08a32420fb6f (diff) |
essays: cleaned up the range section got rid of unused templates and
views
-rw-r--r-- | app/media/admin.py | 13 | ||||
-rw-r--r-- | app/posts/templates/posts/essay_list.html | 10 | ||||
-rw-r--r-- | app/posts/templates/posts/howto_list.html | 22 | ||||
-rw-r--r-- | app/posts/templates/posts/review_detail.html | 115 | ||||
-rw-r--r-- | app/posts/templates/posts/review_list.html | 21 | ||||
-rw-r--r-- | app/posts/urls/craft_urls.py | 29 | ||||
-rw-r--r-- | app/posts/urls/review_urls.py | 29 | ||||
-rw-r--r-- | app/posts/views/craft_views.py | 57 | ||||
-rw-r--r-- | app/posts/views/essay_views.py | 3 |
9 files changed, 13 insertions, 286 deletions
diff --git a/app/media/admin.py b/app/media/admin.py index 8e05d8c..5ee71a5 100644 --- a/app/media/admin.py +++ b/app/media/admin.py @@ -5,6 +5,7 @@ from django.shortcuts import render from django.contrib.admin import helpers from django.http import HttpResponseRedirect +from utils.widgets import OLAdminBase @admin.register(LuxImageSize) class LuxImageSizeAdmin(admin.ModelAdmin): @@ -17,21 +18,11 @@ class LuxVideoAdmin(admin.ModelAdmin): @admin.register(LuxImage) -class LuxImageAdmin(admin.ModelAdmin): +class LuxImageAdmin(OLAdminBase): list_display = ('pk', 'admin_thumbnail', 'pub_date', 'caption', 'location') list_filter = ('pub_date', 'location') search_fields = ['title', 'caption', 'alt'] list_editable = ('location',) - # Options for OSM map Using custom ESRI topo map - default_lon = -9285175 - default_lat = 4025046 - default_zoom = 6 - units = True - scrollable = False - map_width = 700 - map_height = 425 - map_template = 'gis/admin/osm.html' - openlayers_url = '/static/admin/js/OpenLayers.js' fieldsets = ( (None, { diff --git a/app/posts/templates/posts/essay_list.html b/app/posts/templates/posts/essay_list.html index 0b516a6..58163d0 100644 --- a/app/posts/templates/posts/essay_list.html +++ b/app/posts/templates/posts/essay_list.html @@ -4,9 +4,15 @@ {% 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 role="main" id="essay-archive" class="essay-archive archive-list"> - <div class="archive-intro"> + <div class="archive-intro">{% if topic == 'spirit'%} <h1>Spirit</h1> - <h3>Once Spirit meant "breath of a god," and therefore "inspiration; breath of life," hence life itself. Spirit animates us and everything we do; the why behind the what and how.</h3> + <h3>Once Spirit meant "breath of a god," and therefore "inspiration; breath of life," hence life itself. Spirit animates us and everything we do; the why behind the what and how. Requires: <a href="/essays/craft/">Craft</a>, <a href="/essays/tools/">Tools</a>.</h3>{%endif%} + {% if topic == 'craft'%} + <h1>Craft</h1> + <h3>It's not just what you do, but how you do it that creates the world around you. Requires: <a href="/essays/spirit/">Spirit</a>, <a href="/essays/tools/">Tools</a>.</h3>{%endif%} + {% if topic == 'tools'%} + <h1>Tools</h1> + <h3>I am fascinated by artifacts, stuff, the things we populate our lives with. I've chosen to call them tools, but they're more than that aren't they? Requires: <a href="/essays/spirit/">Spirit</a>, <a href="/essays/craft/">Craft</a>.</h3>{%endif%} </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/templates/posts/howto_list.html b/app/posts/templates/posts/howto_list.html deleted file mode 100644 index 13b87c3..0000000 --- a/app/posts/templates/posts/howto_list.html +++ /dev/null @@ -1,22 +0,0 @@ -{% extends 'base.html' %} -{% load typogrify_tags %} -{% 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 role="main" id="essay-archive" class="essay-archive archive-list"> - <div class="archive-intro"> - <h1>Craft</h1> - <h3>It's not just what you do, but how you do it that creates the world around you. -</h3> - </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"> - <span class="date dt-published card-smcaps">{{object.pub_date|date:"F Y"}}</span> - <a href="{{object.get_absolute_url}}"> - <h2 class="card-hed">{{object.title|safe|smartypants|widont}}</h2> - <p class="p-summary card-lede">{% if object.subtitle %}{{object.subtitle}}{%else%}{{object.meta_description|safe|smartypants|widont}}{%endif%}</p> - </a> - </li>{%endfor%} - </ul> - </main> -{%endblock%} diff --git a/app/posts/templates/posts/review_detail.html b/app/posts/templates/posts/review_detail.html deleted file mode 100644 index 7380c7e..0000000 --- a/app/posts/templates/posts/review_detail.html +++ /dev/null @@ -1,115 +0,0 @@ -{% extends 'base.html' %} -{% load typogrify_tags %} -{% load comments %} -{%block htmlclass%}class="detail single"{%endblock%} -{% block pagetitle %}{{object.title|title|smartypants|safe}} - by Scott Gilbertson{% endblock %} - -{% block metadescription %}{% autoescape on %}{{object.meta_description|striptags|safe}}{% endautoescape %}{% endblock %}{%block extrahead%} - <link rel="canonical" href="https://luxagraf.net{{object.get_absolute_url}}" /> -{% if object.has_code %} <link rel="stylesheet" href="/media/src/solarized.css" type="text/css" media="screen"/>{%endif %} -{%endblock%} -{% block breadcrumbs %}{% include "lib/breadcrumbs.html" with breadcrumbs=breadcrumbs %}{% endblock %} -{% block primary %}<main> - <article class="h-entry hentry entry-content content" itemscope itemType="http://schema.org/BlogPosting"> - <header id="header" class="post-header"> - <h1 class="p-name post-title" itemprop="headline">{{object.title|smartypants|safe}}</h1> - {% if object.subtitle %}<h2 class="post-subtitle">{{object.subtitle|smartypants|safe}}</h2>{%endif%} - <div class="post-dateline"><time class="dt-published published dt-updated post-date" style="display:inline" datetime="{{object.pub_date|date:'c'}}" itemprop="datePublished">{{object.pub_date|date:"F"}} <span>{{object.pub_date|date:"Y"}}</span></time> – - {% if object.location %}<div class="p-location h-adr adr post-location" style="display:inline" itemprop="contentLocation" itemscope itemtype="http://schema.org/Place"> - <span class="h-adr" itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">{% if object.location.country_name == "United States" %} - <span class="p-locality locality" itemprop="addressLocality">{{object.location.name|smartypants|safe}}</span>, <span class="p-region region">{{object.location.state_name|safe}}</span><span class="p-country-name" itemprop="addressCountry"></span>{%else%} - <span class="p-region" itemprop="addressRegion">{{object.location.name|smartypants|safe}}</span>, <span class="p-country-name country-name"><span itemprop="addressCountry">{{object.location.country_name|safe}}</span></span>{%endif%} - </span> - </div>{%endif%} - <div>Filed under: <a href="/essays/">{{object.get_post_topic_display}}</a></div> - {% if object.originally_published_by %}<h4 class="post-source">Originally Published By: <a href="{{object.originally_published_by_url}}" title="View {{object.title}} on {{object.originally_published_by}}">{{object.originally_published_by}}</a></h4>{%endif%} - <span class="hide" itemprop="author" itemscope itemtype="http://schema.org/Person">by <a class="p-author h-card" href="/about"><span itemprop="name">Scott Gilbertson</span></a></span> - </div> - </header> - <div class="e-content entry-content post-body" itemprop="articleBody"> - {% if object.prologue_html %}<div class="post-afterward "> - {{object.prologue_html|smartypants|safe}} - </div><hr />{%endif%} - {{object.body_html|safe|smartypants}} - {% if object.epilogue_html %}<div class="post-afterward"> - {{object.epilogue_html|smartypants|safe}} - </div>{%endif%} - </div> - {%if wildlife or object.field_notes.all or object.books.all %}<div class="entry-footer">{%if wildlife %} - <aside id="wildlife"> - <h3>Fauna and Flora</h3> - {% regroup wildlife by ap.apclass.get_kind_display as wildlife_list %} - <ul> - {% for object_list in wildlife_list %} - <li class="grouper">{{object_list.grouper}}<ul> - {% for object in object_list.list %} - <li>{%if object.ap.body_markdown%}<a href="{% url 'sightings:detail' object.ap.slug %}">{{object}}</a>{%else%}{{object}}{%endif%} </li> - {% endfor %}</ul> - {% endfor %}</ul> - </aside> - {% endif %}{%if object.field_notes.all %} - <aside {% if wildlife %}class="margin-left-none" {%endif%}id="field_notes"> - <h3>Field Notes</h3> - <ul>{% for obj in object.field_notes.all %} - <li><a href="{% url 'fieldnotes:detail' year=obj.pub_date.year month=obj.pub_date|date:"m" slug=obj.slug %}">{{obj}}</a></li> - {% endfor %}</ul> - </aside>{% endif %} - {%if object.books.all %} - <aside id="recommended-reading" {%if object.field_notes.all and wildlife %}class="rr-clear{%endif%}" > - <h3>Recommended Reading</h3> - <ul>{% for obj in object.books.all %} - <li><a href="{% url 'books:detail' slug=obj.slug %}"><img src="{{obj.get_small_image_url}}" /></a></li> - {% endfor %}</ul> - </aside>{% endif %} - </div>{%endif%} - </article> - </main> - {% if object.related.all %}<div class="article-afterward related"> - <div class="related-bottom"> - <h6 class="hedtinycaps">You might also enjoy</h6> - <div class="archive-grid-quad">{% for object in related %} - <div class="archive-grid-card archive-grid-card-simple" itemscope itemtype="https://schema.org/Article"> - <a href="{{object.get_absolute_url}}" title="{{object.title}}"> - <div class="card-image-tiny"> - {% if object.featured_image %} - {% include "lib/img_archive.html" with image=object.featured_image nolightbox=True %} - {%endif%} - </div> - <h4 class="p-name card-hed" itemprop="headline">{% if object.title %}{{object.title|safe|smartypants|widont}}{% else %}{{object.common_name}}{%endif%}</h4> - <p class="p-author author hide" itemprop="author"><span class="byline-author" itemscope itemtype="https://schema.org/Person"><span itemprop="name">Scott Gilbertson</span></span></p> - <span class="card-smcaps"> - {% if object.location %}<span class="p-location h-adr adr card-location" itemprop="contentLocation" itemscope itemtype="https://schema.org/Place"> - {% if object.location.country_name == "United States" %}{{object.location.state_name}}{%else%}{{object.location.country_name}}{%endif%} - </span>{%endif%} - {% if object.location and object.model_name.model != 'page' %}–{%endif%} - {% if object.model_name.model != 'page' %}<time class="dt-published published dt-updated" datetime="{{object.pub_date|date:'c'}}"><span>{{object.pub_date|date:" Y"}}</span></time>{%endif%} - </span> - </a> - </div> - {% endfor %}</div> - </div> - </div>{%endif%} - {% comment %} <div class="mailing-list--wrapper"> - <h5>If you enjoyed this, you should join the mailing list…</h5> - {% include 'mailing_list.html' %} - </div> {% endcomment %} - {% if object.enable_comments %} -{% get_comment_count for object as comment_count %} -{%if comment_count > 0 %} -<div class="comment-wrapper"> -<p class="comments-header">{{comment_count}} Comment{{ comment_count|pluralize }}</p> -{% render_comment_list for object %} -{%endif%} -<div class="comment-form-wrapper {%if comment_count > 0%}comment-form-border{%endif%}"> -{% render_comment_form for object %} -</div> -{% else %} -<p class="comments--header" style="text-align: center">Sorry, comments have been disabled for this post.</p> -</div> -{%endif%} -</div> -{% endblock %} -{% block js %} -<script src="/media/js/detail.min.js"></script> -{{ block.super }} -{%endblock%} diff --git a/app/posts/templates/posts/review_list.html b/app/posts/templates/posts/review_list.html deleted file mode 100644 index 6c54f18..0000000 --- a/app/posts/templates/posts/review_list.html +++ /dev/null @@ -1,21 +0,0 @@ -{% extends 'base.html' %} -{% load typogrify_tags %} -{% 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 role="main" id="essay-archive" class="essay-archive archive-list"> - <div class="archive-intro"> - <h1>Tools</h1> - <h3>I am fascinated by artifacts, stuff, the things we populate our lives with. I've chosen to call them tools, but they're more than that aren't they?</h3> - </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"> - <span class="date dt-published card-smcaps">{{object.pub_date|date:"F Y"}}</span> - <a href="{{object.get_absolute_url}}"> - <h2 class="card-hed">{{object.title|safe|smartypants|widont}}</h2> - <p class="p-summary card-lede">{% if object.subtitle %}{{object.subtitle}}{%else%}{{object.meta_description|safe|smartypants|widont}}{%endif%}</p> - </a> - </li>{%endfor%} - </ul> - </main> -{%endblock%} diff --git a/app/posts/urls/craft_urls.py b/app/posts/urls/craft_urls.py deleted file mode 100644 index 92f0f87..0000000 --- a/app/posts/urls/craft_urls.py +++ /dev/null @@ -1,29 +0,0 @@ -from django.urls import path, re_path - -from ..views import craft_views as views - -app_name = "craft" - -urlpatterns = [ - path( - r'<str:slug>', - views.CraftDetailView.as_view(), - name="craft-detail" - ), - path( - r'<str:slug>.txt', - views.CraftDetailViewTXT.as_view(), - name="detail-txt" - ), - path( - r'<int:page>/', - views.CraftListView.as_view(), - name="list" - ), - path( - r'', - views.CraftListView.as_view(), - {'page':1}, - name="list" - ), -] diff --git a/app/posts/urls/review_urls.py b/app/posts/urls/review_urls.py deleted file mode 100644 index 3c8368d..0000000 --- a/app/posts/urls/review_urls.py +++ /dev/null @@ -1,29 +0,0 @@ -from django.urls import path, re_path - -from ..views import review_views as views - -app_name = "reviews" - -urlpatterns = [ - path( - r'<str:slug>', - views.ReviewDetailView.as_view(), - name="review-detail" - ), - path( - r'<str:slug>.txt', - views.ReviewDetailViewTXT.as_view(), - name="review-detail-txt" - ), - path( - r'<int:page>/', - views.ReviewListView.as_view(), - name="review-list" - ), - path( - r'', - views.ReviewListView.as_view(), - {'page':1}, - name="review-list" - ), -] diff --git a/app/posts/views/craft_views.py b/app/posts/views/craft_views.py deleted file mode 100644 index 409e393..0000000 --- a/app/posts/views/craft_views.py +++ /dev/null @@ -1,57 +0,0 @@ -from django.views.generic import ListView -from django.views.generic.detail import DetailView -from django.contrib.syndication.views import Feed -from django.urls import reverse -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 CraftListView(PaginatedListView): - model = Post - template_name = "posts/howto_list.html" - - def get_queryset(self): - queryset = super(CraftListView, self).get_queryset() - return queryset.filter(site__domain='luxagraf.net').filter(post_type__in=[PostType.CRAFT]).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(CraftListView, self).get_context_data(**kwargs) - context['breadcrumbs'] = ('Craft',) - return context - - -class CraftDetailView(LuxDetailView): - model = Post - slug_field = "slug" - - def get_queryset(self): - queryset = super(CraftDetailView, self).get_queryset() - return queryset.select_related('location').prefetch_related('field_notes') - - def get_context_data(self, **kwargs): - context = super(CraftDetailView, 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 - context['breadcrumbs'] = ('Range',) - context['crumb_url'] = reverse('range:range-list') - return context - - def get_template_names(self): - obj = self.get_object() - return ["posts/essay_detail.html"] - - -class CraftDetailViewTXT(CraftDetailView): - template_name = "posts/entry_detail.txt" diff --git a/app/posts/views/essay_views.py b/app/posts/views/essay_views.py index 41fbc03..6437543 100644 --- a/app/posts/views/essay_views.py +++ b/app/posts/views/essay_views.py @@ -38,6 +38,7 @@ class EssayCategoryList(PaginatedListView): for t in PostTopic: if t.label == self.kwargs['topic']: topic = t + self.topic = t.label return queryset.filter(site__domain='luxagraf.net').filter(post_type__in=[PostType.ESSAY],post_topic=topic).filter(status__exact=1).order_by('-pub_date').prefetch_related('location').prefetch_related('featured_image') def get_context_data(self, **kwargs): @@ -46,7 +47,9 @@ class EssayCategoryList(PaginatedListView): ''' # Call the base implementation first to get a context context = super(EssayCategoryList, self).get_context_data(**kwargs) + print(self.topic) context['breadcrumbs'] = ('Essay',) + context['topic'] = self.topic return context |