#NEWLINE# def redirect( post_save_redirect , obj ) : #NEWLINE# #INDENT# "\n    Returns a HttpResponseRedirect to ``post_save_redirect``.\n\n    ``post_save_redirect`` should be a string, and can contain named string-\n    substitution place holders of ``obj`` field names.\n\n    If ``post_save_redirect`` is None, then redirect to ``obj``'s URL returned\n    by ``get_absolute_url()``.  If ``obj`` has no ``get_absolute_url`` method,\n    then raise ImproperlyConfigured.\n\n    This function is meant to handle the post_save_redirect parameter to the\n    ``create_object`` and ``update_object`` views.\n    " #NEWLINE# if post_save_redirect : #NEWLINE# #INDENT# return HttpResponseRedirect ( ( post_save_redirect % post_save_redirect . __dict__ ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if hasattr ( obj , 'get_absolute_url' ) : #NEWLINE# #INDENT# return HttpResponseRedirect ( obj . get_absolute_url ( ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ImproperlyConfigured ( 'No URL to redirect to.  Either pass a post_save_redirect parameter to the generic view or define a get_absolute_url method on the Model.' )