diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/blog/views.py | 21 | ||||
-rw-r--r-- | app/builder/base.py | 24 | ||||
-rw-r--r-- | app/photos/views.py | 10 | ||||
-rw-r--r-- | app/projects/models/gifs.py | 3 |
4 files changed, 48 insertions, 10 deletions
diff --git a/app/blog/views.py b/app/blog/views.py index 8d14fe3..5a7d03b 100644 --- a/app/blog/views.py +++ b/app/blog/views.py @@ -36,8 +36,16 @@ List of all writing def entry_list(request,page): request.page_url = '/writing/%d/' request.page = int(page) + try: + is_build = request.POST['builder'] + extra_context={ + 'page':page, + 'MEDIA_URL': settings.BAKED_MEDIA_URL + } + except: + extra_context={'page':page} qs = Entry.objects.filter(status__exact=1).order_by('-pub_date').select_related() - return object_list(request, queryset=qs, template_name='archives/writing.html', extra_context={'page':page}) + return object_list(request, queryset=qs, template_name='archives/writing.html',extra_context=extra_context) """ @@ -65,9 +73,14 @@ def entry_list_by_area(request,slug,page): qs = Entry.objects.filter(status__exact=1,location__state__country = region).order_by('-pub_date') if not region: raise Http404 - context = { - 'region': region, - } + try: + is_build = request.POST['builder'] + extra_context={ + 'region': region, + 'MEDIA_URL': settings.BAKED_MEDIA_URL + } + except: + extra_context={'region': region,} return object_list(request, queryset=qs, template_name='archives/writing.html', extra_context=context) diff --git a/app/builder/base.py b/app/builder/base.py index 7d57c5e..a112aa0 100644 --- a/app/builder/base.py +++ b/app/builder/base.py @@ -44,7 +44,7 @@ class Build(): path = '%s%s/' %(base_path, page+1) url = '/%s%s/' %(base_path, str(page+1)) page_url = base_path+'%d/' - response = c.post(url, {'page_url': page_url, 'page': int(page), 'MEDIA_URL':settings.BAKED_MEDIA_URL}) + response = c.post(url, {'page_url': page_url, 'page': int(page), 'builder':True }) if page == 0: self.write_file(base_path,str(response.content)) self.write_file(path,str(response.content)) @@ -128,8 +128,7 @@ class BuildPhotos(Build): def build_photo_archive_pages(self): qs = get_model('photos', 'PhotoGallery').objects.all() - path = 'photos/' - self.build_archive_pages(qs, path, 18) + self.build_archive_pages(qs, 'photos/', 18) def build_detail_pages(self): qs = get_model('photos', 'PhotoGallery').objects.all() @@ -144,7 +143,8 @@ class BuildProjects(Build): self.build_project_archive() self.build_project_details() self.build_project_data() - + self.build_gifs() + def get_projects(self): all_proj = [] projects = get_model('projects', 'Project').objects.filter(status__exact=1).order_by('-pub_date') @@ -171,6 +171,22 @@ class BuildProjects(Build): t = render_to_string('details/%s.html' %(proj['slug']), c).encode('utf-8') path = 'projects/%s/' %(proj['slug']) self.write_file(path,t) + + """ + not sure how to handle projects really, the above doesn't work and + if I just keep writing if/else statements that gets messy, so I guess + functions it is. + """ + def build_gifs(self): + qs = get_model('projects', 'AnimatedGif').objects.all() + for gif in qs: + c = Context({'object':gif,'MEDIA_URL':settings.BAKED_MEDIA_URL, 'IMAGES_URL':settings.BAKED_IMAGES_URL}) + t = render_to_string('details/gifs.html',c).encode('utf-8') + path = 'projects/gifs/%s/' %(gif.slug) + self.write_file(path,t) + + + def build_project_data(self): from projects.shortcuts import render_to_geojson diff --git a/app/photos/views.py b/app/photos/views.py index 3edfccb..be97810 100644 --- a/app/photos/views.py +++ b/app/photos/views.py @@ -14,7 +14,15 @@ def gallery_list(request,page): request.page_url = '/photos/%d/' request.page = int(page) qs = PhotoGallery.objects.all() - return object_list(request, queryset=qs, template_name='archives/photos.html',extra_context={'page':page,}) + try: + is_build = request.POST['builder'] + extra_context={ + 'page':page, + 'MEDIA_URL': settings.BAKED_MEDIA_URL + } + except: + extra_context={'page':page} + return object_list(request, queryset=qs, template_name='archives/photos.html',extra_context=extra_context) def gallery(request,slug): context = { diff --git a/app/projects/models/gifs.py b/app/projects/models/gifs.py index b6eb066..e20530b 100644 --- a/app/projects/models/gifs.py +++ b/app/projects/models/gifs.py @@ -21,4 +21,5 @@ class AnimatedGif(models.Model): # Returns the string representation of the model. def __unicode__(self): return self.slug - + def get_absolute_url(self): + return '/projects/gifs/%s/' %(self.slug) |