I want to query if an input value is in a form post and raise an error if it is not:
    try:
        next_page = request.POST.get('next_page')
    except AttributeError:
        raise ImproperlyConfigured(
            "No URL to redirect to.  Either provide a url or define"
            " a get_absolute_url method on the Model.")
However, if next_page is not provided this code results in next_page = None and the error is not raised. Where am I going wrong?
 
     
    