예제 #1
0
def database_change_parameters_retry(request, context, database):
    can_do_change_parameters, error = database.can_do_change_parameters_retry()
    if can_do_change_parameters:
        changed_parameters, parameter_error = DatabaseParameters.update_database_parameters(request.POST, database)

        if parameter_error:
            messages.add_message(request, messages.ERROR, error)
            return HttpResponseRedirect(
                reverse('admin:change_parameters_retry',
                        kwargs={'id': database.id})
            )

        last_change_parameters = database.change_parameters.last()

        if not last_change_parameters.is_status_error:
            error = "Cannot do retry, last change parameters status is '{}'!".format(
                last_change_parameters.get_status_display()
            )
        else:
            since_step = last_change_parameters.current_step

    if error:
        messages.add_message(request, messages.ERROR, error)
    else:
        TaskRegister.database_change_parameters(
            database=database,
            user=request.user,
            since_step=since_step
        )

    return HttpResponseRedirect(
        reverse('admin:logical_database_parameters', kwargs={'id': database.id})
    )
def database_change_parameters_retry(request, context, database):
    can_do_change_parameters, error = database.can_do_change_parameters_retry()
    if can_do_change_parameters:
        changed_parameters, parameter_error = DatabaseParameters.update_database_parameters(
            request.POST, database)

        if parameter_error:
            messages.add_message(request, messages.ERROR, error)
            return HttpResponseRedirect(
                reverse('admin:change_parameters_retry',
                        kwargs={'id': database.id}))

        last_change_parameters = database.change_parameters.last()

        if not last_change_parameters.is_status_error:
            error = "Cannot do retry, last change parameters status is '{}'!".format(
                last_change_parameters.get_status_display())
        else:
            since_step = last_change_parameters.current_step

    if error:
        messages.add_message(request, messages.ERROR, error)
    else:
        TaskRegister.database_change_parameters(database=database,
                                                user=request.user,
                                                since_step=since_step)

    return HttpResponseRedirect(
        reverse('admin:logical_database_parameters',
                kwargs={'id': database.id}))
예제 #3
0
def database_change_parameters(request, context, database):
    can_do_change_parameters, error = database.can_do_change_parameters()
    if not can_do_change_parameters:
        messages.add_message(request, messages.ERROR, error)
    else:
        TaskRegister.database_change_parameters(database=database,
                                                user=request.user)

    return HttpResponseRedirect(
        reverse('admin:logical_database_parameters',
                kwargs={'id': database.id}))
예제 #4
0
def database_change_parameters(request, context, database):
    can_do_change_parameters, error = database.can_do_change_parameters()
    if not can_do_change_parameters:
        messages.add_message(request, messages.ERROR, error)
    else:
        TaskRegister.database_change_parameters(
            database=database,
            user=request.user
        )

    return HttpResponseRedirect(
        reverse('admin:logical_database_parameters', kwargs={'id': database.id})
    )