summaryrefslogtreecommitdiff
path: root/app/posts
diff options
context:
space:
mode:
Diffstat (limited to 'app/posts')
-rw-r--r--app/posts/build.py12
-rw-r--r--app/posts/models.py2
-rw-r--r--app/posts/templates/photo_essay_detail.html4
-rw-r--r--app/posts/views/photo_essay_views.py10
4 files changed, 20 insertions, 8 deletions
diff --git a/app/posts/build.py b/app/posts/build.py
index fdfcd1a..ba0fe27 100644
--- a/app/posts/build.py
+++ b/app/posts/build.py
@@ -175,6 +175,18 @@ class BuildFilms(BuildNew):
self.build_detail_view()
+class BuildPhotoEssays(BuildNew):
+
+ def get_model_queryset(self):
+ return self.model.objects.filter(post_type=PostType.PHOTO_ESSAY).filter(status__exact=1).order_by('-pub_date')
+
+ def build(self):
+ self.build_list_view(
+ base_path=reverse("photo_essay:list"),
+ paginate_by=30
+ )
+ self.build_detail_view()
+
class BuildTrips(BuildNew):
def get_model_queryset(self):
diff --git a/app/posts/models.py b/app/posts/models.py
index 6179fbe..ba578b8 100644
--- a/app/posts/models.py
+++ b/app/posts/models.py
@@ -135,6 +135,8 @@ class Post(models.Model):
return self.title
def get_absolute_url(self):
+ if self.post_type == PostType.PHOTO_ESSAY:
+ return reverse('photo_essay:detail', kwargs={"slug": self.slug})
if self.post_type == PostType.ESSAY:
return reverse('essays:detail', kwargs={"cat": self.get_post_topic_display(), "slug": self.slug})
if self.post_type == PostType.SRC:
diff --git a/app/posts/templates/photo_essay_detail.html b/app/posts/templates/photo_essay_detail.html
index 0655f40..de735f2 100644
--- a/app/posts/templates/photo_essay_detail.html
+++ b/app/posts/templates/photo_essay_detail.html
@@ -9,7 +9,7 @@
{% block breadcrumbs %}{% include "lib/breadcrumbs.html" with breadcrumbs=breadcrumbs %}{% endblock %}
{% block primary %}
<main role="main">
- <figure class="large-top-image">{%with object=object_list%}
+ <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}}"
@@ -30,5 +30,5 @@
{{object.body_html|safe|smartypants}}
</div>
</div>
- </main>{%endwith%}
+ </main>
{% endblock%}
diff --git a/app/posts/views/photo_essay_views.py b/app/posts/views/photo_essay_views.py
index 4f08910..8c35621 100644
--- a/app/posts/views/photo_essay_views.py
+++ b/app/posts/views/photo_essay_views.py
@@ -14,13 +14,11 @@ from taxonomy.models import Category
class PhotoEssayListView(PaginatedListView):
model = Post
# TODO: change this when I have an actual archive to show
- template_name = "photo_essay_detail.html"
+ template_name = "photo_essay_list.html"
def get_queryset(self):
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')
+ 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):
'''
@@ -48,10 +46,10 @@ class PhotoEssayDetailView(LuxDetailView):
related.append(model.objects.get(slug=obj.slug, pub_date=obj.pub_date))
context['related'] = related
context['breadcrumbs'] = ('Photos',)
- context['crumb_url'] = reverse('posts:photo-essay-list')
+ context['crumb_url'] = reverse('photo_essay:list')
return context
def get_template_names(self):
obj = self.get_object()
- return ["film_detail.html"]
+ return ["photo_essay_detail.html"]