diff options
Diffstat (limited to 'app/links')
-rw-r--r-- | app/links/templates/links/link_list.html | 6 | ||||
-rw-r--r-- | app/links/urls.py | 5 | ||||
-rw-r--r-- | app/links/views.py | 8 |
3 files changed, 5 insertions, 14 deletions
diff --git a/app/links/templates/links/link_list.html b/app/links/templates/links/link_list.html index 8f80a28..35992fc 100644 --- a/app/links/templates/links/link_list.html +++ b/app/links/templates/links/link_list.html @@ -17,15 +17,15 @@ </style> {% endblock %} {%block bodyid%}class="links" id="links-archive"{%endblock%} - {% block breadcrumbs %}{% if breadcrumbs %}{% include "lib/breadcrumbs.html" with breadcrumbs=breadcrumbs %}{%endif%}{% endblock %} {% block primary %}<main class="archive-wrapper"> + {{object_list}} {% autopaginate object_list 100 %}{% for object in object_list %} <ul class="archive-list"> <li class="h-entry hentry archive-list-card archive-list-card-sm" itemscope itemType="http://schema.org/Article"> <span class="date dt-published card-smcaps">{{object.pub_date|date:"F Y"}}</span> <h2 class="card-hed"><a href="{{object.url}}">{{object.title|safe|smartypants|widont}}</a><small class="edit"><a target="_blank" href="/admin/links/link/{{object.pk}}/change/">edit</a></small></h2> - <p class="p-summary card-lede">{% for object in object.tags.all %}<a class="tags" href="{% url 'links:list-tag' object.name %}">{{object}}</a>{%endfor%}</p> + <p class="p-summary card-lede">{% for object in object.tags.all %}<a class="tags" href="{% url 'links:list-tag' object.slug %}">{{object}}</a>{%endfor%}</p> </li>{%endfor%} </ul> </main> @@ -34,7 +34,7 @@ </nav> <div class="tags"> <ul class="tag-list">{% for object in tags %} - <li><a href="/links/tag/{{object.slug}}">{{object.name}}</a></li>{%endfor%} + <li><a href="{% url 'links:list-tag' object.slug %}">{{object.name}}</a></li>{%endfor%} </ul> </div> {% endblock %} diff --git a/app/links/urls.py b/app/links/urls.py index 792a5ea..f789b4d 100644 --- a/app/links/urls.py +++ b/app/links/urls.py @@ -17,11 +17,6 @@ urlpatterns = [ views.LinkTagListView.as_view(), name='list-tag' ), - re_path( - r'(?P<slug>[-\d]+).txt$', - views.LinkDetailViewTXT.as_view(), - name="detail-txt" - ), path( r'<int:slug>', views.LinkDetailView.as_view(), diff --git a/app/links/views.py b/app/links/views.py index 4beff5d..e95cff4 100644 --- a/app/links/views.py +++ b/app/links/views.py @@ -20,21 +20,17 @@ class LinkTagListView(PaginatedListView): model = Link def get_queryset(self): - print(self.kwargs['slug']) - return Link.objects.filter(tags__slug=self.kwargs['slug']) + return Link.objects.filter(tags__name__in=[self.kwargs['slug']]) def get_context_data(self, **kwargs): # Call the base implementation first to get a context context = super(LinkTagListView, self).get_context_data(**kwargs) context['tag'] = Tag.objects.get(slug__exact=self.kwargs['slug']) context['tags'] = Link.tags.all() + context['breadcrumbs'] = ('Links',) return context class LinkDetailView(DetailView): model = Link slug_field = "id" - - -class LinkDetailViewTXT(LinkDetailView): - template_name = "details/entry.txt" |