summaryrefslogtreecommitdiff
path: root/app/utils
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf>2021-01-30 17:41:42 -0500
committerluxagraf <sng@luxagraf>2021-01-30 17:41:42 -0500
commite36adb590425ee6fb15a03ef690b6a279c49250a (patch)
tree533ee7cd8cb26bcca8e7a69a639ec0aacb8d8c9c /app/utils
parentc7fee3786a0221fb3a7032491b0a2d512f0b27c4 (diff)
views: cleaned up some view code and streamlined breadcrumbs
Diffstat (limited to 'app/utils')
-rw-r--r--app/utils/views.py12
1 files changed, 2 insertions, 10 deletions
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: