summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/builder/views.py5
-rw-r--r--app/pages/templates/pages/luxagraf/homepage.html2
-rw-r--r--app/posts/admin.py2
-rw-r--r--app/posts/build.py13
-rw-r--r--app/posts/models.py6
-rw-r--r--app/posts/templates/posts/trip_detail.html37
-rw-r--r--app/posts/templates/posts/trip_list.html2
-rw-r--r--app/posts/urls/trip_urls.py12
-rw-r--r--app/posts/views/trip_views.py18
-rw-r--r--config/base_urls.py4
-rw-r--r--templates/admin/index.html2
11 files changed, 81 insertions, 22 deletions
diff --git a/app/builder/views.py b/app/builder/views.py
index 85e7226..bb23686 100644
--- a/app/builder/views.py
+++ b/app/builder/views.py
@@ -6,7 +6,7 @@ from resume.build import pub_builder, resume_builder
from books.build import builder as book_builder
from sightings.build import builder as sightings_builder
from pages.build import BuildPages, BuildHome
-from posts.build import BuildJrnl, BuildFieldNotes, BuildSrc, BuildGuide, BuildEssays, BuildRange, BuildFriends, BuildFilms
+from posts.build import BuildJrnl, BuildFieldNotes, BuildSrc, BuildGuide, BuildEssays, BuildRange, BuildFriends, BuildFilms, BuildTrips
def do_build(request):
section = request.GET.get('id', '')
@@ -28,6 +28,9 @@ def do_build(request):
elif section == 'films':
context = {'message': 'Writing films to Disk'}
BuildFilms("posts", "post").build()
+ elif section == 'trips':
+ context = {'message': 'Writing trips to Disk'}
+ BuildTrips("posts", "trip").build()
elif section == 'essays':
context = {'message': 'Writing essays to Disk'}
BuildEssays("posts", "post").build()
diff --git a/app/pages/templates/pages/luxagraf/homepage.html b/app/pages/templates/pages/luxagraf/homepage.html
index df97ba3..db08c0f 100644
--- a/app/pages/templates/pages/luxagraf/homepage.html
+++ b/app/pages/templates/pages/luxagraf/homepage.html
@@ -44,7 +44,7 @@
<section class="homepage-bio-section">
<h2 class="homepage-section-header">About Luxagraf</h2>
<div class="homepage-bio-wrapper">
- <a href="/travels/"><img src="/media/img/usa-resize.svg" alt="map of travels" class="homepage-map-img" /></a>
+ <a href="/trips/"><img src="/media/img/usa-resize.svg" alt="map of travels" class="homepage-map-img" /></a>
<div>
<p>We’re a family of five living full time in a vintage 1969 Dodge Travco motorhome. We’ve been at it for six years now. Sometimes we break down, which led to <a href="/essay/turn-your-own-wrenches">this <em>Wired</em> magazine story</a>. People sometimes ask: <a href="https://luxagraf.net/1969-dodge-travco-motorhome">What's it like for five people to live in a 26ft RV</a>? <a href="https://luxagraf.net/essay/why-a-vintage-rv">Why do we live this way</a>?</p>
<p>If you're curious, <a href="/jrnl/">read through the journal</a>. If you like it, sign up for the private mailing list, <a href="/friends/"><em>Friends of a Long Year</em></a>. You can also sign up to <a href="/cards">get a postcard</a> from us on the road. Yes. Seriously. Or you might prefer to <a href="/feed.xml">subscribe to the RSS feed</a>. <!-- If you’re interested there’s a guide section with some <a href="/guides/">advice, tips and tricks for those who’d aspire to live full time in a van or RV</a> --></p>
diff --git a/app/posts/admin.py b/app/posts/admin.py
index ea1d8a4..196e6b3 100644
--- a/app/posts/admin.py
+++ b/app/posts/admin.py
@@ -43,7 +43,7 @@ class PostAdmin(OSMGeoAdmin):
('Entry', {
'fields': (
('title', 'short_title'),
- 'subtitle',
+ ('subtitle', 'trip'),
'body_markdown',
('pub_date', 'status', 'post_type'),
('slug', 'enable_comments',),
diff --git a/app/posts/build.py b/app/posts/build.py
index 7f5dc7b..e5dc1ed 100644
--- a/app/posts/build.py
+++ b/app/posts/build.py
@@ -163,3 +163,16 @@ class BuildFilms(BuildNew):
paginate_by=30
)
self.build_detail_view()
+
+
+class BuildTrips(BuildNew):
+
+ def get_model_queryset(self):
+ return self.model.objects.all()
+
+ def build(self):
+ self.build_list_view(
+ base_path=reverse("trips:list"),
+ paginate_by=30
+ )
+ self.build_detail_view()
diff --git a/app/posts/models.py b/app/posts/models.py
index 7322881..93d686a 100644
--- a/app/posts/models.py
+++ b/app/posts/models.py
@@ -41,6 +41,7 @@ def get_upload_path(self, filename):
class Trip(models.Model):
title = models.CharField(max_length=300)
subtitle = models.CharField(max_length=200, blank=True)
+ dek = models.TextField(null=True, blank=True)
slug = models.SlugField()
body_markdown = models.TextField()
body_html = models.TextField(blank=True)
@@ -49,12 +50,15 @@ class Trip(models.Model):
featured_image = models.ForeignKey(LuxImage, on_delete=models.SET_NULL, null=True, blank=True)
order = models.PositiveIntegerField("order", null=True, blank=True)
- def __str_(self):
+ def __str__(self):
return self.title
class Meta:
ordering = ('-order',)
+ def get_absolute_url(self):
+ return reverse('trips:detail', kwargs={"slug": self.slug})
+
def save(self, *args, **kwargs):
created = self.pk is None
if not created:
diff --git a/app/posts/templates/posts/trip_detail.html b/app/posts/templates/posts/trip_detail.html
new file mode 100644
index 0000000..82bd5e3
--- /dev/null
+++ b/app/posts/templates/posts/trip_detail.html
@@ -0,0 +1,37 @@
+{% extends 'base.html' %}
+{% load typogrify_tags %}
+{% block pagetitle %}Luxagraf | Range {% endblock %}
+{% block metadescription %}A weekly photo, developed.{% endblock %}
+{% block breadcrumbs %}{% include "lib/breadcrumbs.html" with breadcrumbs=breadcrumbs %}{% endblock %}
+{% block primary %}
+<main class="archive-wrapper">
+ <figure class="large-top-image">
+ <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>{%endwith%}
+ </figure>
+ <div class="archive-intro">
+ <h1 class="list-hed">{{object.title|safe|smartypants|widont}}</h1>
+ {{object.body_html|safe|smartypants|widont}}
+ </div>
+ <h3 class="archive-sans">Stories</h3>
+ <div class="archive-grid">{% for object in posts %}
+ <article class="h-entry hentry archive-grid-card" itemscope itemType="http://schema.org/Article">
+ <div class="card-image">
+ <a href="{{object.get_absolute_url}}" title="{{object.title}}">
+ {% include "lib/img_archive.html" with image=object.featured_image %}
+ </a>
+ </div>
+ <h2 class="p-name card-hed-it" itemprop="headline"><a href="{{object.get_absolute_url}}" class="u-url" title="{{object.title}}">{{object.title|safe|smartypants|widont}}</a></h2>
+ <p class="p-author author hide" itemprop="author"><span class="byline-author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">Scott Gilbertson</span></span></p>
+ <time class="dt-published published dt-updated card-smcaps" datetime="{{object.pub_date|date:'c'}}">{{object.pub_date|date:"F"}} <span>{{object.pub_date|date:"j, Y"}}</span></time>
+ </article> {% endfor %}
+ </div>
+ </main>
+{%endblock%}
+
+ <p>If you're not familiar, darktable is open source raw image developer. It's free, you can download a copy for Linux, macOS, or Windows. The <a href="https://www.darktable.org/usermanual/en/">darktable user manual</a> is very helpful if you're brand new. I also recommend <a href="https://www.youtube.com/user/audio2u">Bruce Williams' darktable videos</a>, and <a href="https://www.youtube.com/user/s7habo/videos">Boris Hajdukovic's videos</a>, which were the inspiration for what you see here.</p>
+ <p>I'm no expert either, so feel free to hit reply and let me know if I get something wrong.</p>
diff --git a/app/posts/templates/posts/trip_list.html b/app/posts/templates/posts/trip_list.html
index 9fa2495..f8d6450 100644
--- a/app/posts/templates/posts/trip_list.html
+++ b/app/posts/templates/posts/trip_list.html
@@ -24,7 +24,7 @@
<time class="dt-published published dt-updated card-smcaps" datetime="{{object.date_started|date:'c'}}">{{object.date_started|date:"F Y"}} &ndash; {% if object.title == "The Big Blue Bus"%}<a href="/jrnl/">present</a>{%else%}{{object.date_ended|date:"F Y"}}{%endif%}</time>
<p class="card-summary card-dek">
<span class="p-summary" itemprop="description">
- {{object.body_html|smartypants|safe}}
+ {{object.dek|smartypants|safe}}
</span>
</p>
</article> {% endfor %}
diff --git a/app/posts/urls/trip_urls.py b/app/posts/urls/trip_urls.py
index 91d3c33..7e9c95f 100644
--- a/app/posts/urls/trip_urls.py
+++ b/app/posts/urls/trip_urls.py
@@ -7,9 +7,19 @@ app_name = "trips"
urlpatterns = [
path(
+ r'<str:slug>',
+ views.TripDetailView.as_view(),
+ name="detail"
+ ),
+ path(
+ r'<int:page>/',
+ views.TripListView.as_view(),
+ name="list"
+ ),
+ path(
r'',
views.TripListView.as_view(),
{'page':1},
- name="trip-list"
+ name="list"
),
]
diff --git a/app/posts/views/trip_views.py b/app/posts/views/trip_views.py
index 0079652..5753069 100644
--- a/app/posts/views/trip_views.py
+++ b/app/posts/views/trip_views.py
@@ -17,22 +17,12 @@ class TripListView(PaginatedListView):
template_name = "posts/trips_list.html"
class TripDetailView(LuxDetailView):
- model = Post
+ model = Trip
slug_field = "slug"
+ template_name = "posts/trip_detail.html"
- def get_queryset(self):
- queryset = super(PostDetailView, self).get_queryset()
- return queryset.select_related('location').prefetch_related('field_notes')
def get_context_data(self, **kwargs):
- context = super(PostDetailView, 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 = super(TripDetailView, self).get_context_data(**kwargs)
+ context['posts'] = Post.objects.filter(status__exact=1,trip=self.object)
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']
diff --git a/config/base_urls.py b/config/base_urls.py
index e684e3f..b5e0f1e 100644
--- a/config/base_urls.py
+++ b/config/base_urls.py
@@ -52,6 +52,8 @@ urlpatterns = [
path(r'film/', include('posts.urls.film_urls')),
re_path(r'^film/$', RedirectView.as_view(url='/films/')),
path(r'films/', include('posts.urls.film_urls', namespace='films')),
+ re_path(r'^trip/$', RedirectView.as_view(url='/trips/')),
+ path(r'trip/', include('posts.urls.trip_urls')),
path(r'trips/', include('posts.urls.trip_urls', namespace='trips')),
#path(r'review/', include('posts.urls.review_urls')),
#re_path(r'^review/$', RedirectView.as_view(url='/reviews/')),
@@ -59,8 +61,8 @@ urlpatterns = [
#path(r'guide/', include('posts.urls.guide_urls')),
#re_path(r'^guide/$', RedirectView.as_view(url='/guides/')),
#path(r'guides/', include('posts.urls.guide_urls', namespace='guide-list')),
- path(r'essay/', include('posts.urls.essay_urls')),
re_path(r'^essay/$', RedirectView.as_view(url='/essays/')),
+ path(r'essay/', include('posts.urls.essay_urls')),
path(r'essays/', include('posts.urls.essay_urls', namespace='essay-list')),
path(r'range/', include('posts.urls.range_urls', namespace='range')),
path(r'friends/', include('posts.urls.friends_urls', namespace='friends')),
diff --git a/templates/admin/index.html b/templates/admin/index.html
index e2285f8..91678f6 100644
--- a/templates/admin/index.html
+++ b/templates/admin/index.html
@@ -49,7 +49,7 @@ td, th {
<div id="content-main">
<ul class="faux-btns">
<li><a href="https://awstats.luxagraf.net/cgi-bin/awstats.pl?config=luxagraf.net" target="_blank">lxf awstats</a></li>
- <li><a href="https://stats.luxagraf.net/" target="_blank">lxf stats</a></li>
+ <li><a href="/admin/build/build?id=trips" target="_blank">Build Trips</a></li>
<li><a href="/admin/build/build?id=buildbooks">Build Books</a></li>
<li><a href="/admin/build/build?id=pubs">Build Publications</a></li>
<li><a href="/admin/build/build?id=resume">Build Resume</a></li>