All pastes #1515905 Raw Edit

Mine

public text v1 · immutable
#1515905 ·published 2009-08-02 18:34 UTC
rendered paste body
# Create your views here.
from shorturls.forms import AddUrlForm

def main(request):
    if request.method == 'POST':
        form = AddUrlForm(long_url=request.POST['url'], author=request.author)
        if form.is_valid():
            new_url = form.save()
            return HttpResponseRedirect(createdSuccess)
        else:
            form = AddUrlForm(author=request.user)
        return render_to_response('home.html', { 'addUrlForm': form })
    else:
        context = {}
        #This is the line that fails
        if request.user.is_authenticated() and request.user.is_active():
            context['addUrlForm'] = AddUrlForm(author=request.author)
        else:
            context['addUrlForm'] = AddUrlform()
        return render_to_reponse('home.html', context)