From 64f5a3f949c94248e90d1583cb1cd558cda1acf7 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Sun, 27 Mar 2016 20:36:09 -0400 Subject: added build script to birds app --- app/TODO | 12 ------------ app/birds/build.py | 21 +++++++++++++++++++++ app/birds/models.py | 4 ++++ app/builder/views.py | 4 ++++ design/templates/admin/buttons.html | 1 + 5 files changed, 30 insertions(+), 12 deletions(-) diff --git a/app/TODO b/app/TODO index 553c387..1d801b3 100644 --- a/app/TODO +++ b/app/TODO @@ -34,19 +34,7 @@ port existing galleries to new structure --- -# birds app: - -Finish detail template -write build script - ---- - # notes revamp notes to be like my own personal instagram ---- - -#content marketing page: - -Consistently posted high-quality content, and research into topics are still paramount to your web presence. The better your content, the better your SEO. diff --git a/app/birds/build.py b/app/birds/build.py index e69de29..870133f 100644 --- a/app/birds/build.py +++ b/app/birds/build.py @@ -0,0 +1,21 @@ +import os +from django.core.urlresolvers import reverse +from builder.base import BuildNew + + +class BuildBirds(BuildNew): + + def build(self): + self.build_detail_view() + self.build_list_view( + base_path=reverse("birds:list_redirect"), + paginate_by=24 + ) + print("building birds") + + def get_model_queryset(self): + return self.model.objects.all() + +def builder(): + j = BuildBirds("birds", "birdsighting") + j.build() diff --git a/app/birds/models.py b/app/birds/models.py index af31c3f..afb6099 100644 --- a/app/birds/models.py +++ b/app/birds/models.py @@ -10,6 +10,7 @@ from django.conf import settings from photos.models import LuxImage + def get_upload_path(self, filename): return "images/bird-images/%s/%s" % (datetime.datetime.today().strftime("%Y"), filename) @@ -126,6 +127,9 @@ class BirdSighting(models.Model): if size.width > 360 and size.width < 700: return img.get_image_by_size(size) + def get_absolute_url(self): + return reverse("birds:detail", kwargs={"slug": self.bird.slug}) + def __str__(self): return self.bird.common_name diff --git a/app/builder/views.py b/app/builder/views.py index 4fc6d6a..dfce406 100644 --- a/app/builder/views.py +++ b/app/builder/views.py @@ -5,6 +5,7 @@ from src.build import builder as src_builder from jrnl.build import archive_builder, detail_builder, home_builder, rss_builder, amp_builder from resume.build import builder as resume_builder from books.build import builder as book_builder +from birds.build import builder as bird_builder from photos.build import builder as photo_builder from figments.build import builder as figments_builder @@ -40,6 +41,9 @@ def do_build(request): elif section == 'buildbooks': context = {'message': 'Writing Book Pages to Disk'} book_builder() + elif section == 'buildbirds': + context = {'message': 'Writing Bird Pages to Disk'} + bird_builder() elif section == 'src': context = {'message': 'Writing src section to Disk'} src_builder() diff --git a/design/templates/admin/buttons.html b/design/templates/admin/buttons.html index b512625..777d7e5 100644 --- a/design/templates/admin/buttons.html +++ b/design/templates/admin/buttons.html @@ -48,6 +48,7 @@
  • Build Project Pages
  • Build Map
  • Build Books
  • +
  • Build Birds
  • Build All Pages
  • Build Sitemap
  • Build src
  • -- cgit v1.2.3