diff options
author | luxagraf <sng@luxagraf.net> | 2013-05-02 09:40:19 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2013-05-02 09:40:19 -0400 |
commit | f3dcfb4e840f51fd0329be7a994ca8864c5f85e8 (patch) | |
tree | f5ad2022c0eb36acaa3a8cb04e6aa44395c72d88 /app/builder/base.py | |
parent | 21709e6628cc0acfce9f229462048dbf27817695 (diff) |
added a function to build writing by region
Diffstat (limited to 'app/builder/base.py')
-rw-r--r-- | app/builder/base.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/app/builder/base.py b/app/builder/base.py index cdd919f..21b5335 100644 --- a/app/builder/base.py +++ b/app/builder/base.py @@ -52,7 +52,8 @@ class BuildWriting(Build): def build(self): self.build_detail_pages() self.build_writing_archives() - self.build_location_archive_pages() + self.build_country_archive_pages() + self.build_region_archive_pages() self.build_homepage() self.writing_year_archives() self.writing_month_archives() @@ -80,7 +81,16 @@ class BuildWriting(Build): qs = self.get_model_querset() self.build_archive_pages(qs, 'writing/') - def build_location_archive_pages(self): + def build_region_archive_pages(self): + model = get_model('locations', 'Region') + blog = get_model('blog', 'entry') + regions = model.objects.all() + for c in regions: + qs = blog.objects.filter(status__exact=1,region = c).order_by('-pub_date') + path = 'writing/%s/' %(c.slug) + self.build_archive_pages(qs, path) + + def build_country_archive_pages(self): model = get_model('locations', 'Country') blog = get_model('blog', 'entry') countries = model.objects.filter(visited=True) |