summaryrefslogtreecommitdiff
path: root/apps/blog/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'apps/blog/views.py')
-rw-r--r--apps/blog/views.py14
1 files changed, 3 insertions, 11 deletions
diff --git a/apps/blog/views.py b/apps/blog/views.py
index 9641813..6ccdc28 100644
--- a/apps/blog/views.py
+++ b/apps/blog/views.py
@@ -9,10 +9,9 @@ from blog.models import Entry
from locations.models import Region, Country
def home(request):
- featured = Entry.objects.filter(status__exact=1).order_by('-pub_date')[:1].get()
+ featured = Entry.objects.filter(status__exact=1).latest()
context = {
'featured': featured,
- 'object_list': Entry.objects.all().exclude(id=featured.id).order_by('-pub_date')[:5],
}
return render_to_response('archives/homepage.html', context, context_instance = RequestContext(request))
@@ -32,13 +31,8 @@ List of all writing
def entry_list(request,page):
request.page_url = '/writing/%d/'
request.page = int(page)
- qs = Entry.objects.filter(status__exact=1).order_by('-pub_date')
- context = {
- 'country_list': Country.objects.filter(visited=True),
- 'region_list': Region.objects.all()
- }
- return object_list(request, queryset=qs, template_name='archives/writing.html',
- extra_context=context)
+ qs = Entry.objects.filter(status__exact=1).order_by('-pub_date').select_related()
+ return object_list(request, queryset=qs, template_name='archives/writing.html')
"""
@@ -57,8 +51,6 @@ def entry_list_by_area(request,slug,page):
raise Http404
context = {
'region': region,
- 'country_list': Country.objects.filter(visited=True),
- 'region_list': Region.objects.all()
}
return object_list(request, queryset=qs, template_name='archives/writing.html',
extra_context=context)