summaryrefslogtreecommitdiff
path: root/app/resume/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/resume/views.py')
-rw-r--r--app/resume/views.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/app/resume/views.py b/app/resume/views.py
index 9cdd8e7..b4b6762 100644
--- a/app/resume/views.py
+++ b/app/resume/views.py
@@ -1,5 +1,6 @@
from django.views.generic.detail import DetailView
from django.views.generic.base import TemplateView
+from django.shortcuts import get_object_or_404
from utils.views import PaginatedListView
from .models import PubItem, Publisher, Resume
@@ -43,17 +44,16 @@ class PageView(DetailView):
model = Page
slug_field = "slug"
- def get_queryset(self):
- try:
- return Page.objects.get(path__startswith=self.kwargs['path'])
- except:
- return Page.objects.get(path__startswith=self.kwargs['path'],slug=self.kwargs['slug'])
-
+ def get_object(self, **kwargs):
+ print("calling page view")
+ return get_object_or_404(Page, path=self.kwargs['path'], slug=self.kwargs['slug'])
def get_template_names(self):
return ["details/%s.html" % self.object.slug, 'details/page.html']
-
-class ResumeView(DetailView):
- model = Resume
- template_name = "details/resume.html"
+ def get_context_data(self, **kwargs):
+ # Call the base implementation first to get a context
+ context = super(PageView, self).get_context_data(**kwargs)
+ if self.kwargs['slug'] == 'resume':
+ context['resume'] = Resume.objects.get(title='base')
+ return context