summaryrefslogtreecommitdiff
path: root/app/posts
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2024-12-27 09:47:42 -0600
committerluxagraf <sng@luxagraf.net>2024-12-27 09:47:42 -0600
commit8c7b0e1abe1983fac38322c3bc01165c4c693d7e (patch)
tree2f91e32f0dae419fe46f773fe9a11817b809fcf0 /app/posts
parent05b386315c09c735201566cf8945fc8ff78d2741 (diff)
jrnl: added a photo essay post type and new url/template/views. also cleared out some old unneeded files
Diffstat (limited to 'app/posts')
-rw-r--r--app/posts/models.py1
-rw-r--r--app/posts/templates/photo_essay_detail.html34
-rw-r--r--app/posts/urls/photo_essay_urls.py (renamed from app/posts/urls/film_urls.py)10
-rw-r--r--app/posts/views/photo_essay_views.py (renamed from app/posts/views/film_views.py)27
4 files changed, 55 insertions, 17 deletions
diff --git a/app/posts/models.py b/app/posts/models.py
index 377225f..6179fbe 100644
--- a/app/posts/models.py
+++ b/app/posts/models.py
@@ -73,6 +73,7 @@ class PostType(models.IntegerChoices):
SRC = 3, ('src')
JRNL = 4, ('jrnl')
FIELD_NOTE = 5, ('field note')
+ PHOTO_ESSAY = 6, ('photo essay')
class PostTopic(models.IntegerChoices):
diff --git a/app/posts/templates/photo_essay_detail.html b/app/posts/templates/photo_essay_detail.html
new file mode 100644
index 0000000..8195ae7
--- /dev/null
+++ b/app/posts/templates/photo_essay_detail.html
@@ -0,0 +1,34 @@
+{% extends 'base.html' %}
+{%block htmlclass%}class="detail single"{% endblock %}
+{% load typogrify_tags %}
+{% load html5_datetime %}
+{% load pagination_tags %}
+{% block pagetitle %} Photos | luxagraf {% endblock %}
+{% block metadescription %} Recent Images {% endblock %}
+{%block bodyid%}class="photos" id="notes-archive"{%endblock%}
+{% block breadcrumbs %}{% include "lib/breadcrumbs.html" with breadcrumbs=breadcrumbs %}{% endblock %}
+{% block primary %}
+ <main role="main">
+ <figure class="large-top-image">{%with object=object_list%}
+ <a href="{{object.get_absolute_url}}" title="{{object.title}}">{%with image=object.featured_image%}
+ <img style="margin:0;" sizes="(max-width: 960px) 100vw"
+ srcset="{{image.get_srcset}}"
+ src="{{image.get_src}}"
+ alt="{{image.alt}} photographed by {% if image.photo_credit_source %}{{image.photo_credit_source}}{%else%}luxagraf{%endif%}">
+ </a>
+ </figure>{%endwith%}
+ <div class="folio-wrapper">
+ <article class="h-entry hentry 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>
+ <div class="post-dateline">
+ <time class="hide dt-published published dt-updated post-date lttr-box" datetime="{{object.pub_date|date:'c'}}" itemprop="datePublished"><span>{{object.pub_date|date:"F j, Y"}}</span></time>
+ <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 id="article" class="e-content entry-content post-body" itemprop="articleBody">
+ {{object.body_html|safe|smartypants}}
+ </div>
+ </div>
+ </main>{%endwith%}
+{% endblock%}
diff --git a/app/posts/urls/film_urls.py b/app/posts/urls/photo_essay_urls.py
index 872d3f4..e69f07c 100644
--- a/app/posts/urls/film_urls.py
+++ b/app/posts/urls/photo_essay_urls.py
@@ -1,23 +1,23 @@
from django.urls import path, re_path
-from ..views import film_views as views
+from ..views import photo_essay_views as views
-app_name = "film"
+app_name = "photo_essay"
urlpatterns = [
path(
r'<str:slug>',
- views.FilmDetailView.as_view(),
+ views.PhotoEssayDetailView.as_view(),
name="detail"
),
path(
r'<int:page>/',
- views.FilmListView.as_view(),
+ views.PhotoEssayListView.as_view(),
name="list"
),
path(
r'',
- views.FilmListView.as_view(),
+ views.PhotoEssayListView.as_view(),
{'page':1},
name="list"
),
diff --git a/app/posts/views/film_views.py b/app/posts/views/photo_essay_views.py
index 48bdaa4..4f08910 100644
--- a/app/posts/views/film_views.py
+++ b/app/posts/views/photo_essay_views.py
@@ -11,44 +11,47 @@ from ..models import Post, PostType
from taxonomy.models import Category
-class FilmListView(PaginatedListView):
+class PhotoEssayListView(PaginatedListView):
model = Post
- template_name = "posts/film_list.html"
+ # TODO: change this when I have an actual archive to show
+ template_name = "photo_essay_detail.html"
def get_queryset(self):
- queryset = super(FilmListView, self).get_queryset()
- return queryset.filter(site__domain='luxagraf.net').filter(post_type__in=[PostType.FILM]).filter(status__exact=1).order_by('-pub_date').prefetch_related('location').prefetch_related('featured_image')
+ queryset = super(PhotoEssayListView, self).get_queryset()
+ return queryset.get(slug="dawn")
+ # real queryset
+ #return queryset.filter(site__domain='luxagraf.net').filter(post_type__in=[PostType.PHOTO_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(FilmListView, self).get_context_data(**kwargs)
- context['breadcrumbs'] = ('Film',)
+ context = super(PhotoEssayListView, self).get_context_data(**kwargs)
+ context['breadcrumbs'] = ('Photos',)
return context
-class FilmDetailView(LuxDetailView):
+class PhotoEssayDetailView(LuxDetailView):
model = Post
slug_field = "slug"
def get_queryset(self):
- queryset = super(FilmDetailView, self).get_queryset()
+ queryset = super(PhotoEssayDetailView, self).get_queryset()
return queryset.select_related('location').prefetch_related('field_notes')
def get_context_data(self, **kwargs):
- context = super(FilmDetailView, self).get_context_data(**kwargs)
+ context = super(PhotoEssayDetailView, 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')
+ context['breadcrumbs'] = ('Photos',)
+ context['crumb_url'] = reverse('posts:photo-essay-list')
return context
def get_template_names(self):
obj = self.get_object()
- return ["posts/film_detail.html"]
+ return ["film_detail.html"]