summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/posts/urls/guide_urls.py15
-rw-r--r--app/posts/views/field_note_views.py9
-rw-r--r--app/posts/views/guide_views.py7
-rw-r--r--app/posts/views/jrnl_views.py1
-rw-r--r--app/taxonomy/views.py6
-rw-r--r--app/utils/views.py12
-rw-r--r--config/base_urls.py2
7 files changed, 20 insertions, 32 deletions
diff --git a/app/posts/urls/guide_urls.py b/app/posts/urls/guide_urls.py
index 8927034..47cc3c5 100644
--- a/app/posts/urls/guide_urls.py
+++ b/app/posts/urls/guide_urls.py
@@ -12,25 +12,10 @@ urlpatterns = [
{'page':1},
name="guide-base"
),
- path(r'field-test/', include('posts.urls.review_urls', namespace='reviews')),
- re_path(r'^field-test/$', RedirectView.as_view(url='/field-tests/')),
- #path(r'field-tests/', include('posts.urls', namespace='review-list')),
- #path(r'review/', include('posts.review_urls')),
- re_path(r'^review/$', RedirectView.as_view(url='/guides/')),
path(
r'<str:topic>/',
views.GuideTopicListView.as_view(),
{'page':1},
name="guides-by-topic"
),
- #path(
- # r'<str:slug>',
- # views.EntryDetailView.as_view(),
- # name="detail"
- #),
- #re_path(
- # r'<int:page>/',
- # views.EntryList.as_view(),
- # name="list"
- #),
]
diff --git a/app/posts/views/field_note_views.py b/app/posts/views/field_note_views.py
index e635ac5..15ce3ff 100644
--- a/app/posts/views/field_note_views.py
+++ b/app/posts/views/field_note_views.py
@@ -13,6 +13,14 @@ class FieldNoteListView(PaginatedListView):
Return a list of Notes in reverse chronological order
"""
queryset = Post.objects.filter(post_type=PostType.FIELD_NOTE,status=1).order_by('-pub_date')
+
+ def get_context_data(self, **kwargs):
+ '''
+ Add breadcrumb path
+ '''
+ context = super(FieldNoteListView, self).get_context_data(**kwargs)
+ context['breadcrumbs'] = ("field notes",)
+ return context
class FieldNoteDetailView(LuxDetailView):
@@ -37,3 +45,4 @@ class FieldNoteMonthArchiveView(MonthArchiveView):
date_field = "pub_date"
make_object_list = True
template_name = "posts/fieldnote_archive_list_date.html"
+
diff --git a/app/posts/views/guide_views.py b/app/posts/views/guide_views.py
index 5b15af1..aea91dd 100644
--- a/app/posts/views/guide_views.py
+++ b/app/posts/views/guide_views.py
@@ -36,7 +36,12 @@ class GuideTopicListView(PaginatedListView):
def get_context_data(self, **kwargs):
context = super(GuideTopicListView, self).get_context_data(**kwargs)
- context['topic'] = Category.objects.get(slug=self.kwargs['topic'])
+ topic = Category.objects.get(slug=self.kwargs['topic'])
+ context['topic'] = topic
+ context['breadcrumbs'] = ('Guides', topic.name )
+
+
+ Category.objects.get(slug=self.kwargs['topic'])
return context
diff --git a/app/posts/views/jrnl_views.py b/app/posts/views/jrnl_views.py
index 0dc2dc8..bfc0a42 100644
--- a/app/posts/views/jrnl_views.py
+++ b/app/posts/views/jrnl_views.py
@@ -30,6 +30,7 @@ class JrnlListView(PaginatedListView):
context['breadcrumbs'] = ['jrnl',]
return context
+
class JrnlCountryListView(PaginatedListView):
"""
Return a list of Entries by Country in reverse chronological order
diff --git a/app/taxonomy/views.py b/app/taxonomy/views.py
index 2d749ab..354234c 100644
--- a/app/taxonomy/views.py
+++ b/app/taxonomy/views.py
@@ -1,14 +1,12 @@
from django.views.generic import ListView
-from django.views.generic.detail import DetailView
from django.contrib.syndication.views import Feed
from django.urls import reverse
from django.conf import settings
-#from paypal.standard.forms import PayPalPaymentsForm
-
from .models import Category
+from utils.views import LuxDetailView
-class CategoryDetailView(DetailView):
+class CategoryDetailView(LuxDetailView):
model = Category
slug_field = "slug"
diff --git a/app/utils/views.py b/app/utils/views.py
index f1e947a..b337cc5 100644
--- a/app/utils/views.py
+++ b/app/utils/views.py
@@ -6,16 +6,15 @@ from django.views.generic import ListView, DetailView
from django.apps import apps
from django.shortcuts import render
from django.template import RequestContext
+from django.template.defaultfilters import slugify
from media.models import LuxImage, LuxVideo, LuxAudio
from recordings.models import Audio
BREADCRUMBS = {
- 'SrcPost':'SRC',
'AP':'dialogue',
'Book':'Book Notes',
- 'Entry':'Jrnl',
'NewsletterMailing':'lttr',
'LuxImage':'lttr',
'Sighting':'dialogue'
@@ -38,13 +37,6 @@ class PaginatedListView(ListView):
request.base_path = path
return super(PaginatedListView, self).dispatch(request, *args, **kwargs)
- def get_context_data(self, **kwargs):
- '''
- Adds breadcrumb path to every view
- '''
- # Call the base implementation first to get a context
- context = super(PaginatedListView, self).get_context_data(**kwargs)
- print('model=', self.model)
try:
context['breadcrumbs'] = (BREADCRUMBS[self.model.__name__],)
except KeyError:
@@ -71,7 +63,7 @@ class LuxDetailView(DetailView):
context['breadcrumbs'] = (self.object.get_post_type_display()+"s",)
else:
context['breadcrumbs'] = (self.object.get_post_type_display(),)
- context['crumb_url'] = "/%ss/" % self.object.get_post_type_display()
+ context['crumb_url'] = "/%ss/" % slugify(self.object.get_post_type_display())
else:
context['breadcrumbs'] = (self.object._meta.verbose_name_plural,)
try:
diff --git a/config/base_urls.py b/config/base_urls.py
index 2260016..34141ca 100644
--- a/config/base_urls.py
+++ b/config/base_urls.py
@@ -39,10 +39,8 @@ urlpatterns = [
path(r'sitemap.xml', sitemap, {'sitemaps': sitemaps}),
path(r'links/', include('links.urls')),
path(r'newsletter/', include('lttr.urls')),
- #path(r'jrnl/', include('jrnl.urls')),
path(r'jrnl/', include('posts.urls.jrnl_urls', namespace='jrnl')),
#path(r'projects/', include('projects.urls')),
- path(r'topics/', include('taxonomy.urls')),
path(r'walk/', include('locations.walk_urls')),
path(r'walks/', include('locations.walk_urls')),
path(r'locations/', include('locations.urls')),