Source

noodle-bucket / feedback / views.py

Full commit
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext

from noodlebucket.feedback.forms import FeedbackRepoRequestForm

def request_repo(request):
    """Request that a repository be added to Noodle Bucket."""
    
    if request.method == 'POST':
        form = FeedbackRepoRequestForm(request.POST)
        if form.is_valid():
            form.save()
            
            return HttpResponseRedirect(reverse('request-repo-thanks'))
    else:
        form = FeedbackRepoRequestForm()
    
    return render_to_response(
        'feedback/request_repo.html',
        { 'form': form },
        context_instance=RequestContext(request)
    )

def request_repo_thanks(request):
    return render_to_response(
        'feedback/request_repo_thanks.html', {},
        context_instance=RequestContext(request)
    )