From 0031ea3b8feea6612a9d37212f350c623ff3b902 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Fri, 10 May 2024 14:57:18 -0500 Subject: essays: cleaned up the range section got rid of unused templates and views --- app/media/admin.py | 13 +-- app/posts/templates/posts/essay_list.html | 10 ++- app/posts/templates/posts/howto_list.html | 22 ----- app/posts/templates/posts/review_detail.html | 115 --------------------------- app/posts/templates/posts/review_list.html | 21 ----- app/posts/urls/craft_urls.py | 29 ------- app/posts/urls/review_urls.py | 29 ------- app/posts/views/craft_views.py | 57 ------------- app/posts/views/essay_views.py | 3 + 9 files changed, 13 insertions(+), 286 deletions(-) delete mode 100644 app/posts/templates/posts/howto_list.html delete mode 100644 app/posts/templates/posts/review_detail.html delete mode 100644 app/posts/templates/posts/review_list.html delete mode 100644 app/posts/urls/craft_urls.py delete mode 100644 app/posts/urls/review_urls.py delete mode 100644 app/posts/views/craft_views.py 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 %}
-
+
{% if topic == 'spirit'%}

Spirit

-

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.

+

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: Craft, Tools.

{%endif%} + {% if topic == 'craft'%} +

Craft

+

It's not just what you do, but how you do it that creates the world around you. Requires: Spirit, Tools.

{%endif%} + {% if topic == 'tools'%} +

Tools

+

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: Spirit, Craft.

{%endif%}
    {% for object in object_list %}
  • 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 %}
    -
    -

    Craft

    -

    It's not just what you do, but how you do it that creates the world around you. -

    -
    - -
    -{%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%} - -{% if object.has_code %} {%endif %} -{%endblock%} -{% block breadcrumbs %}{% include "lib/breadcrumbs.html" with breadcrumbs=breadcrumbs %}{% endblock %} -{% block primary %}
    -
    -
    -

    {{object.title|smartypants|safe}}

    - {% if object.subtitle %}

    {{object.subtitle|smartypants|safe}}

    {%endif%} - -
    -
    - {% if object.prologue_html %}
    - {{object.prologue_html|smartypants|safe}} -

    {%endif%} - {{object.body_html|safe|smartypants}} - {% if object.epilogue_html %}
    - {{object.epilogue_html|smartypants|safe}} -
    {%endif%} -
    - {%if wildlife or object.field_notes.all or object.books.all %}{%endif%} -
    -
    - {% if object.related.all %}
    - -
    {%endif%} - {% comment %}
    -
    If you enjoyed this, you should join the mailing list…
    - {% include 'mailing_list.html' %} -
    {% endcomment %} - {% if object.enable_comments %} -{% get_comment_count for object as comment_count %} -{%if comment_count > 0 %} -
    -

    {{comment_count}} Comment{{ comment_count|pluralize }}

    -{% render_comment_list for object %} -{%endif%} -
    -{% render_comment_form for object %} -
    -{% else %} -

    Sorry, comments have been disabled for this post.

    -
    -{%endif%} -
-{% endblock %} -{% block js %} - -{{ 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 %}
-
-

Tools

-

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?

-
- -
-{%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'', - views.CraftDetailView.as_view(), - name="craft-detail" - ), - path( - r'.txt', - views.CraftDetailViewTXT.as_view(), - name="detail-txt" - ), - path( - r'/', - 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'', - views.ReviewDetailView.as_view(), - name="review-detail" - ), - path( - r'.txt', - views.ReviewDetailViewTXT.as_view(), - name="review-detail-txt" - ), - path( - r'/', - 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 -- cgit v1.2.3-70-g09d2