diff options
Diffstat (limited to 'app/blog/views.py')
-rw-r--r-- | app/blog/views.py | 52 |
1 files changed, 21 insertions, 31 deletions
diff --git a/app/blog/views.py b/app/blog/views.py index 04564fc..8c86839 100644 --- a/app/blog/views.py +++ b/app/blog/views.py @@ -1,28 +1,28 @@ -from django.shortcuts import render_to_response,get_object_or_404 +from django.shortcuts import render_to_response, get_object_or_404 from django.template import RequestContext from django.http import Http404 from django.conf import settings -from django.views.generic import ListView +# from django.views.generic import ListView from blog.models import Entry from locations.models import Region, Country -from photos.models import Photo, PhotoGallery +from photos.models import Photo + def home(request): context = { 'object_list': Entry.objects.filter(status__exact=1).select_related()[:4] - } - return render_to_response('archives/homepage.html', context, context_instance = RequestContext(request)) + } + return render_to_response('archives/homepage.html', context, context_instance=RequestContext(request)) def entry_detail(request, year, month, day, slug): obj = get_object_or_404(Entry, slug__exact=slug) photos = {} - #if obj.photo_gallery: + # if obj.photo_gallery: # photos = Photo.objects.filter(set__exact=obj.get().photo_gallery.id)[:9] - extra = {'photos':photos,} - return render_to_response('details/entry.html', {'object': obj,'photos':photos}, context_instance=RequestContext(request)) - + extra = {'photos': photos, } + return render_to_response('details/entry.html', {'object': obj, 'photos': photos}, context_instance=RequestContext(request)) """ List of all writing @@ -39,35 +39,35 @@ class BlogEntryListView(ListView): return context """ -def entry_list(request,page): + + +def entry_list(request, page): request.page_url = '/writing/%d/' request.page = int(page) try: - is_build = request.POST['builder'] - extra_context={ - 'page':page, + extra_context = { + 'page': page, 'MEDIA_URL': settings.BAKED_MEDIA_URL } except: - extra_context={'page':page} + extra_context = {'page': page} context = { 'object_list': Entry.objects.filter(status__exact=1).order_by('-pub_date').select_related(), } return render_to_response("archives/writing.html", context, context_instance=RequestContext(request)) -""" -Grabs entries by region or country -""" -def entry_list_by_area(request,slug,page): - request.page_url = '/writing/'+slug+'/%d/' +def entry_list_by_area(request, slug, page): + """ Grabs entries by region or country""" + request.page_url = '/writing/' + slug + '/%d/' request.page = int(page) try: region = Region.objects.get(slug__exact=slug) - qs = Entry.objects.filter(status__exact=1,region = region).order_by('-pub_date') + qs = Entry.objects.filter(status__exact=1, region=region).order_by('-pub_date') except: region = Country.objects.get(slug__exact=slug) - qs = Entry.objects.filter(status__exact=1,location__state__country = region).order_by('-pub_date') + qs = Entry.objects.filter( + status__exact=1, location__state__country=region).order_by('-pub_date') if not region: raise Http404 context = { @@ -75,13 +75,3 @@ def entry_list_by_area(request,slug,page): 'object_list': qs, } return render_to_response("archives/writing.html", context, context_instance=RequestContext(request)) - -""" -def about(request): - qs = Chunk.objects.filter(key__in=['about_top','about_middle','about_bottom']) - context = { - 'object_list':qs, - 'IMAGES_URL' : settings.IMAGES_URL - } - return render_to_response('details/about.html', context, context_instance=RequestContext(request)) -""" |