1. Colin Copeland
  2. django-committees

Source

django-committees / committees / views.py

from django.db import transaction
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext

from committees.models import Committee, Profile


def list_committees(request):
    context = {
        'committees': Committee.objects.select_related().all(),
    }
    return render_to_response('committees/list.html', context,
                              context_instance=RequestContext(request))


def view_committee(request, committee_slug):
    context = {
        'committee': get_object_or_404(Committee, slug=committee_slug)
    }
    return render_to_response('committees/view.html', context,
                              context_instance=RequestContext(request))


def view_profile(request, profile_slug):
    context = {
        'profile': get_object_or_404(Profile, slug=profile_slug)
    }
    return render_to_response('committees/profile.html', context,
                              context_instance=RequestContext(request))