diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/guide/views.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/app/guide/views.py b/app/guide/views.py index dc63fc5..50a42d2 100644 --- a/app/guide/views.py +++ b/app/guide/views.py @@ -1,6 +1,5 @@ from django.shortcuts import render_to_response,get_object_or_404 from django.template import RequestContext -from django.views.generic.list_detail import object_list from django.core.exceptions import ObjectDoesNotExist from guide.models import Guide @@ -10,21 +9,29 @@ def guide_list(request,page): """ List of all guides """ - request.page_url = '/guide/%d/' + request.page_url = "/guide/%d/" request.page = int(page) - qs = Guide.objects.filter(status__exact=1).order_by('-pub_date').select_related() - return object_list(request, queryset=qs, template_name='archives/guide.html', extra_context={'page':page}) + context={ + 'object_list':Guide.objects.filter(status__exact=1).order_by('-pub_date').select_related(), + 'page':page, + } + return render_to_response("archives/guide.html", context, context_instance=RequestContext(request)) def guide_list_by_location(request,location): - qs = Guide.objects.filter(location__slug__exact=location) - return object_list(request, queryset=qs, template_name='archives/writing.html') + context={ + "object_list": Guide.objects.filter(location__slug__exact=location), + } + return render_to_response("archives/guide.html", context, context_instance=RequestContext(request)) def location_list(request): """ List of all locations with guides """ - qs = Guide.objects.filter(status__exact=1).order_by('-pub_date').select_related() - return object_list(request, queryset=qs, template_name='archives/guide.html') + context={ + "object_list": Guide.objects.filter(status__exact=1).order_by('-pub_date').select_related() + } + return render_to_response("archives/guide.html", context, context_instance=RequestContext(request)) + def guide_detail(request, slug, location=None): obj = get_object_or_404(Guide, slug__exact=slug) |