validation cant reach inside it

hello Pals,
i have form add unit with validation for valid form and inside valid i have other validation if the object already inside database. but it always get out of the second validation,
it work with add new but when i try add obj already there it break out of the valid validation.

else:
     messages.error(
     request,
     f"({name}) failed, already exists",
)

This Code Never reach it.

def add_unit_names(request):
    lst = Lst.objects.all()

    if request.method == "POST":
        frm = LstFrm(request.POST or None)

        if frm.is_valid():
            sv_frm = frm.save(commit=False)
            name = request.POST.get("name")
            match = UnitNames.objects.filter(name=name).exists()

            if not match:
                sv_frm.save()
                name = sv_frm.name
                id = sv_frm.id
                messages.success(request, f"({name}) created successfully.")
                return redirect(reverse("home", args=(id,)))
            else:
                messages.error(
                    request,
                    f"({name}) failed, already exists",
                )
        else:
            messages.error(
                request,
                "Please fill in the form with valid data.",
            )
            frm = LstFrm()
    else:
        frm = LstFrm()

I’m not understanding what you’re saying here.

What specifically is happening when:

And what isn’t happening that you’re expecting to have happen?

the main picture is to add Unit object - if form is_valid() check again if the entered object is unique or already there with same name - if unique save form this works fine - but if it is already in database with same name it must display this below

but what happens that it is displaying this instead.

as i understand form is valid so i will be waiting for one of this choices [ Save the form, message it is already there ]
why it display form is not valid. while it was inside it and it was valid at first.

i hope i made it little clear.