Source

django-feature-request / feature_request / views.py

Full commit
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect, HttpResponse, Http404
from django.core.urlresolvers import reverse

from feature_request.forms import FeatureRequestForm

def render_response(request, template_name, template_params={}):
    return render_to_response(template_name, 
        context_instance=RequestContext(request, template_params))

@login_required
def add(request):
    
    user = request.user
        
    if request.method == 'POST':
        form = FeatureRequestForm(request.POST)
        if form.is_valid():
            form.save(user)
            return HttpResponseRedirect(reverse('feature_request_home'))
    else :
        form = FeatureRequestForm()             
    return render_response(request, 'feature_request/add.html', {'form':form,})

def view_all(request):
    feature_requests = FeatureRequest.objects.get_features()
    return render_response(request, 'feature_request/view_all.html', {'feature_requests':feature_requests})