From 6ad212ae8a542e93d173c2b8e6efcd68109380c8 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Mon, 7 Dec 2015 20:19:06 -0500 Subject: added ability to edit resume landing and cv from pages app --- app/resume/urls.py | 9 ++------- app/resume/views.py | 10 +++++----- 2 files changed, 7 insertions(+), 12 deletions(-) (limited to 'app/resume') diff --git a/app/resume/urls.py b/app/resume/urls.py index ce9c435..bc54d36 100644 --- a/app/resume/urls.py +++ b/app/resume/urls.py @@ -22,13 +22,8 @@ urlpatterns = [ name="live-redirect" ), url( - r'^(?P[-\w]+)$', + r'^(?P[-\w]+)(?:/(?P[-\w]+))$', views.PageView.as_view(), - name="cv" - ), - url( - r'^$', - views.BaseView.as_view(), - name="intro" + name="pages" ), ] diff --git a/app/resume/views.py b/app/resume/views.py index 7e5de14..d7230f7 100644 --- a/app/resume/views.py +++ b/app/resume/views.py @@ -30,11 +30,11 @@ class PageView(DetailView): slug_field = "slug" def get_queryset(self): - return Page.objects.filter(path__startswith=self.kwargs['slug']) + 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_template_names(self): return ["details/%s.html" % self.object.slug, 'details/page.html'] - - -class BaseView(TemplateView): - template_name = "archives/resume.html" -- cgit v1.2.3-70-g09d2