(request, domain, app_id, module_id=None, form_id=None,
                 form_unique_id=None, module_unique_id=None)
return HttpResponseRedirect(reverse(view_name, args=args))
returns an HttpResponseRedirect back to the main page for the App Manager app
    with the correct GET parameters.

    This is meant to be used by views that process a POST request,
    which then redirect to the main page.
returns an HttpResponseRedirect back to the main page for the App Manager app
    with the correct GET parameters.
returns an HttpResponseRedirect back to the main page for the App Manager app with the correct GET parameters .
def back_to_main(request, domain, app_id, module_id=None, form_id=None,
                 form_unique_id=None, module_unique_id=None):
    """
    returns an HttpResponseRedirect back to the main page for the App Manager app
    with the correct GET parameters.

    This is meant to be used by views that process a POST request,
    which then redirect to the main page.

    """
    args = [domain, app_id]
    view_name = 'view_app'

    app = get_app(domain, app_id)

    module = None
    try:
        if module_id is not None:
            module = app.get_module(module_id)
        elif module_unique_id is not None:
            module = app.get_module_by_unique_id(module_unique_id)
    except ModuleNotFoundException:
        raise Http404()

    form = None
    if form_id is not None and module is not None:
        try:
            form = module.get_form(form_id)
        except IndexError:
            raise Http404()
    elif form_unique_id is not None:
        try:
            form = app.get_form(form_unique_id)
        except FormNotFoundException:
            raise Http404()

    if form is not None:
        view_name = 'form_source' if form.can_edit_in_vellum else 'view_form'
        args.append(form.unique_id)
    elif module is not None:
        view_name = 'view_module'
        args.append(module.unique_id)

    return HttpResponseRedirect(reverse(view_name, args=args))
def back_to_main ( request , domain , app_id , module_id = None , form_id = None , form_unique_id = None , module_unique_id = None ) : args = [ domain , app_id ] view_name = 'view_app' app = get_app ( domain , app_id ) module = None try : if module_id is not None : module = app . get_module ( module_id ) elif module_unique_id is not None : module = app . get_module_by_unique_id ( module_unique_id ) except ModuleNotFoundException : raise Http404 ( ) form = None if form_id is not None and module is not None : try : form = module . get_form ( form_id ) except IndexError : raise Http404 ( ) elif form_unique_id is not None : try : form = app . get_form ( form_unique_id ) except FormNotFoundException : raise Http404 ( ) if form is not None : view_name = 'form_source' if form . can_edit_in_vellum else 'view_form' args . append ( form . unique_id ) elif module is not None : view_name = 'view_module' args . append ( module . unique_id ) return HttpResponseRedirect ( reverse ( view_name , args = args ) )