from django.shortcuts import render_to_response, get_object_or_404 from django.template import RequestContext from .models import Entry, Topic def topic(request, slug): obj = get_object_or_404(Topic, slug__exact=slug) qs = Entry.objects.filter(topics__slug=slug).order_by('-pub_date') return render_to_response('archives/src_home.html', {'object_list': qs, 'topic':obj}, context_instance=RequestContext(request)) def detail(request, slug): obj = get_object_or_404(Entry, slug__exact=slug) return render_to_response('details/src_entry.html', {'object': obj}, context_instance=RequestContext(request))