(request, domain, app_id)
return back_to_main(request, domain, app_id=app_id)
Copies a saved doc back to the original.
    See ApplicationBase.revert_to_copy
Copies a saved doc back to the original.
    See ApplicationBase.revert_to_copy
Copies a saved doc back to the original . See ApplicationBase . revert_to_copy
def revert_to_copy(request, domain, app_id):
    """
    Copies a saved doc back to the original.
    See ApplicationBase.revert_to_copy

    """
    app = get_app(domain, app_id)
    copy = get_app(domain, request.POST['build_id'])
    if copy.get_doc_type() == 'LinkedApplication' and app.get_doc_type() == 'Application':
        copy = copy.convert_to_application()
    app = app.make_reversion_to_copy(copy)
    app.save()
    messages.success(
        request,
        _("Successfully reverted to version %(old_version)s, now at version %(new_version)s") % {
            'old_version': copy.version,
            'new_version': app.version,
        }
    )
    copy_build_comment_params = {
        "old_version": copy.version,
        "original_comment": copy.build_comment,
    }
    if copy.build_comment:
        copy_build_comment_template = _(
            "Reverted to version {old_version}\n\nPrevious build comments:\n{original_comment}")
    else:
        copy_build_comment_template = _("Reverted to version {old_version}")

    copy = app.make_build(
        comment=copy_build_comment_template.format(**copy_build_comment_params),
        user_id=request.couch_user.get_id,
    )
    copy.save(increment_version=False)
    return back_to_main(request, domain, app_id=app_id)
def revert_to_copy ( request , domain , app_id ) : app = get_app ( domain , app_id ) copy = get_app ( domain , request . POST [ 'build_id' ] ) if copy . get_doc_type ( ) == 'LinkedApplication' and app . get_doc_type ( ) == 'Application' : copy = copy . convert_to_application ( ) app = app . make_reversion_to_copy ( copy ) app . save ( ) messages . success ( request , _ ( "Successfully reverted to version %(old_version)s, now at version %(new_version)s" ) % { 'old_version' : copy . version , 'new_version' : app . version , } ) copy_build_comment_params = { "old_version" : copy . version , "original_comment" : copy . build_comment , } if copy . build_comment : copy_build_comment_template = _ ( "Reverted to version {old_version}\n\nPrevious build comments:\n{original_comment}" ) else : copy_build_comment_template = _ ( "Reverted to version {old_version}" ) copy = app . make_build ( comment = copy_build_comment_template . format ( * * copy_build_comment_params ) , user_id = request . couch_user . get_id , ) copy . save ( increment_version = False ) return back_to_main ( request , domain , app_id = app_id )