Submit form data with modal

I can’t send the form data through the modal

My file

class CrearReclamacion(CreateView):
    model = Rec
    form_class = RecForm
    template_name = 'reclamaciones/reclamacion.html'
    success_url = reverse_lazy('Reclamaciones')


<!-- Modal -->
<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel"
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="addModalLabel">Nueva Reclamacion</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
      <form action="" method="POST" enctype="multipart/form-data" class="form-control">
        {% csrf_token %}
        <div class="modal-body">

          <div class="mb-3">
            <div class="form-label">{{ form.num_reclamacion.label }}</div>
            <div class="col-12">{{ form.num_reclamacion }}</div>
          <div class="mb-3">
            <div class="form-label">{{ form.num_cliente.label }}</div>
            <div class="col-12">{{ form.num_cliente }}</div>
          <div class="mb-3">
            <div class="form-label">{{ form.empresa.label }}</div>
            <div class="col-12">{{ form.empresa }}</div>
          <div class="mb-3">
            <div class="form-label">{{ form.tipo.label }}</div>
            <div class="col-12">{{ form.tipo }}</div>
          <div class="mb-3">
            <div class="form-label">{{ form.atiende.label }}</div>
            <div class="col-12">{{ form.atiende }}</div>
          <div class="mb-3">
            <div class="form-label">{{ form.delegacion_departamento.label }}</div>
            <div class="col-12">{{ form.delegacion_departamento }}</div>
          <div class="mb-3">
            <div class="form-label">{{ form.motivo.label }}</div>
            <div class="col-12">{{ form.motivo }}</div>
          <div class="mb-3">
            <div class="form-label">{{ form.descripcion.label }}</div>
            <div class="col-12">{{ form.descripcion }}</div>
          <div><button type="submit" class="btn btn-success">Enviar informacion</button></div>


button that opens the modal

    <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addModal">
      Nueva Reclamacion

I attach image when I send the data

Do you know what can happen?

A 405 is a “Method Not Allowed” error. That means you’re trying to post to a URL that doesn’t accept a POST.

Are you getting any traceback or other error message on the server?

What URL is it posting to? Can you verify that that is the correct url for the submission?

If you’re dynamically loading that dialog box, you’re going to want to render the proper url in the action attribute of your form tag, because the url to which you want to post that form isn’t likely to be the same page from which the original page was rendered.

Are you getting any traceback or other error message on the server?

On the server it tells me
Method Not Allowed (POST): /claims/
Method Not Allowed: /claims/
[20/Feb/2023 14:24:08] “POST /complaints/ HTTP/1.1” 405 0

What URL is it posting to? Can you verify that that is the correct url for the submission?

I don’t understand what you mean by URL is publishing

This fragment of your server log looks like it might be from two different errors. (Seeing more of the log might help)

It appears like you’re trying to POST to both /claims/ and /complaints/, neither of which are set up to accept a POST request.

What url is assigned to the CrearReclamacion view?

urlpatterns = [
    path('reclamaciones/',login_required(ListarReclamacion.as_view()), name='Reclamaciones'),
    path('noConformidad/', NoConformidad, name='NoConformidad'),
    path('crear/', login_required(CrearReclamacion.as_view()), name='crear_reclamacion'),
    path('reclamaciones/eliminar/<int:pk>', login_required(EliminarReclamacion.as_view()), name='eliminar_reclamacion'),
    path('reclamaciones/editar/<int:pk>', login_required(ActualizarReclam.as_view()), name='editarrec'),

Hello, you’re submitting data to

because of action url. Check this and put correct url

Thank you very much, I already saw the problem.