def _handle_response(request, instance=None):
    '''
    Handles redirects for completet form actions. Returns a redirect to the
    last page, the user came from. If not given, to the detail-view of
    the object. Last fallback is a redirect to the common success page.
    '''
    if 'next' in request.REQUEST:
        return HttpResponseRedirect(request.REQUEST['next'])
    if instance and hasattr(instance, 'get_absolute_url'):
        return HttpResponseRedirect(instance.get_absolute_url())
    return HttpResponseRedirect(reverse('frontendadmin_success'))
dataset/ETHPy150Open bartTC/django-frontendadmin/frontendadmin/views.py/_handle_response/original