diff options
author | luxagraf <sng@luxagraf.net> | 2015-12-07 22:12:41 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2015-12-07 22:12:41 -0500 |
commit | abbe348602df0d4c32a1bad0960107d7eadc59a7 (patch) | |
tree | 06d865a0bdb5591c54bf8cfd07a2f94da72f5ebe /app/resume | |
parent | 5dc9b251a29c79fdd0dafc9ef79318e8f213cb3a (diff) |
finished up resume section
Diffstat (limited to 'app/resume')
-rw-r--r-- | app/resume/build.py | 13 | ||||
-rw-r--r-- | app/resume/urls.py | 11 | ||||
-rw-r--r-- | app/resume/views.py | 13 |
3 files changed, 36 insertions, 1 deletions
diff --git a/app/resume/build.py b/app/resume/build.py index 9d6ad60..964aba9 100644 --- a/app/resume/build.py +++ b/app/resume/build.py @@ -3,6 +3,8 @@ from django.core.urlresolvers import reverse from builder.base import BuildNew from pages.models import Page +from .models import Publisher + class BuildResume(BuildNew): @@ -10,8 +12,9 @@ class BuildResume(BuildNew): self.build_detail_view() self.build_list_view( base_path=reverse("resume:live_redirect"), - paginate_by=8 + paginate_by=9999 ) + self.build_publisher_list() def get_model_queryset(self): return self.model.objects.all() @@ -26,6 +29,14 @@ class BuildResume(BuildNew): print(path, slug) self.write_file(path, response.content, filename=slug) + def build_publisher_list(self): + publishers = Publisher.objects.all() + for publisher in publishers: + self.build_list_view( + base_path=reverse("resume:live_publisher_redirect", kwargs={'publisher': publisher.slug, }), + paginate_by=9999 + ) + def build_pages(self): ''' build out /resume and /resume/cv diff --git a/app/resume/urls.py b/app/resume/urls.py index 791f834..0d8b40a 100644 --- a/app/resume/urls.py +++ b/app/resume/urls.py @@ -12,10 +12,21 @@ urlpatterns = [ name='list', ), url( + r'pubs/(?P<publisher>[-\w]+)/(?P<page>\d+)/$', + views.ByPublisherListView.as_view(), + name='list_by_publisher', + ), + url( r'pubs/(?P<publisher>[-\w]+)/(?P<slug>[-\w]+)$', views.PubItemDetailView.as_view(), name='detail', ), + # redirect /slug/ to /slug/1/ for live server + url( + r'pubs/(?P<publisher>[-\w]+)/$', + RedirectView.as_view(url="/resume/pubs/%(publisher)s/1/", permanent=False), + name="live_publisher_redirect" + ), url( r'pubs/$', RedirectView.as_view(url="/resume/pubs/1/", permanent=False), diff --git a/app/resume/views.py b/app/resume/views.py index d7230f7..15acf14 100644 --- a/app/resume/views.py +++ b/app/resume/views.py @@ -19,6 +19,19 @@ class PublisherListView(PaginatedListView): return context +class ByPublisherListView(PaginatedListView): + template_name = 'archives/resume-pubs-by-pub.html' + + def get_queryset(self): + print(self.kwargs['publisher']) + return PubItem.objects.filter(publisher__slug=self.kwargs['publisher']) + + def get_context_data(self, **kwargs): + # Call the base implementation first to get a context + context = super(ByPublisherListView, self).get_context_data(**kwargs) + context['publisher'] = Publisher.objects.get(slug=self.kwargs['publisher']) + return context + class PubItemDetailView(DetailView): model = PubItem template_name = "details/resume.html" |