summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/posts/templates/posts/range_detail.html42
-rw-r--r--app/posts/views/range_views.py8
2 files changed, 28 insertions, 22 deletions
diff --git a/app/posts/templates/posts/range_detail.html b/app/posts/templates/posts/range_detail.html
index 008a572..15b4cd5 100644
--- a/app/posts/templates/posts/range_detail.html
+++ b/app/posts/templates/posts/range_detail.html
@@ -150,30 +150,28 @@
</aside>
</div>
{% if object.related.all %}<div class="article-afterward related">
- <div class="related-bottom">
+ <div class="related-bottom">
<h6 class="hedtinycaps">You might also enjoy</h6>
- <ul class="article-card-list">{% for object in related %}
- <li class="article-card-mini"><a href="{{object.get_absolute_url}}" title="{{object.title}}">
- <div class="post-image post-mini-image">
- {% if object.featured_image %}
- {% include "lib/img_archive.html" with image=object.featured_image nolightbox=True %}
- {% elif object.image %}
- {% include "lib/img_archive.html" with image=object.image nolightbox=True %}
- {% else %}
- <img src="{{object.get_image_url}}" alt="{{ object.title }}" class="u-photo post-image" itemprop="image" />{%endif%}
- </div>
- <h4 class="p-name entry-title post-title" 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="http://schema.org/Person"><span itemprop="name">Scott Gilbertson</span></span></p>
- <p class="post-summary">
- <span class="p-location h-adr adr post-location" itemprop="contentLocation" itemscope itemtype="http://schema.org/Place">
- {% if object.location.country_name == "United States" %}{{object.location.state_name}}{%else%}{{object.location.country_name}}{%endif%}
- </span>
- &ndash;
- <time class="dt-published published dt-updated post-date" datetime="{{object.pub_date|date:'c'}}"><span>{{object.pub_date|date:" Y"}}</span></time>
- </p>
+ <div class="archive-grid-quad">{% for object in related %}
+ <div class="archive-grid-card archive-grid-card-simple">
+ <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="http://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="http://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' %}&ndash;{%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>
- </li>
- {% endfor %}</ul>
+ </div>
+ {% endfor %}</div>
</div>
</div>{%endif%}
</main>
diff --git a/app/posts/views/range_views.py b/app/posts/views/range_views.py
index 0a3a564..0a808b8 100644
--- a/app/posts/views/range_views.py
+++ b/app/posts/views/range_views.py
@@ -22,6 +22,14 @@ class RangeDetailView(LuxDetailView):
slug_field = "slug"
template_name = "posts/range_detail.html"
+ def get_context_data(self, **kwargs):
+ context = super(RangeDetailView, 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
+ return context
class RangeListView(PaginatedListView):
"""