Inline formset not saving

I'm having trouble with an inline formset that saves files. It used to work as expected, but it stopped doing so.

I'm new to Django and Python, so I don't know much about debugging in this environment.

It doesn't throw any error, the terminal only shows the POST, and the parent forms saves its changes.

It's worth mentioning that, if I use a normal form to store those files, they get saved in the database and in the filesystem. So, the problem must be in the formset itself.

Any help would be much appreciated.

Thanks in advance.

Here are my forms

class ReporteForm(forms.ModelForm):
    class Meta:
        model = Reporte
        fields = ('fecha', 'tipo', 'nis', 'descripcion')

    def __init__(self, *args, **kwargs):
        pk = kwargs.pop('pk', None)
        super(ReporteForm, self).__init__(*args, **kwargs)
        self.fields['pk'].queryset = Reporte.objects.filter(pk=pk)

class ArchivosForm(forms.ModelForm): 
    class Meta:                
        model = ArchivosReporte
        fields = ['archivo', 'reporte']
ArchivoInlineFormset = inlineformset_factory(

My View

class ReporteCV(CreateView):
    model = Reporte
    context_object_name = 'contexto'    
    fields = ['fecha', 'tipo', 'nis', 'descripcion']
    template_name = "segcom/modal_form.html"
    def form_valid(self, form):
        if form.has_changed():
            self.object = 
            reporte = self.object               
         formset = ArchivoInlineFormset(request.POST,request.FILES)

         if formset.has_changed(): #### IT'S NOT BEING TRIGGERED
            archivos =
            for archivo in archivos:
                if actualizacion:
                    archivo.actualizacion = reporte
                    archivo.reporte = reporte

        return HttpResponseRedirect(self.request.META.get('HTTP_REFERER'))

    def form_invalid(self, form):
        return self.render_to_response(self.get_context_data(form=form))

my html

<div id="modalForm" class="modal" tabindex="-1">
  <div class="modal-dialog modal-lg">
      <div class="modal-content">
          <div class="modal-header">
              <h5 class="modal-title">{{titulo}} {{reporte_id}}</h5>
              <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button>
          <div class="modal-body card-block">
            <form method = "post" action="{% url 'reporte_add' %}" id="reporte-form" enctype="multipart/form-data">

                {% csrf_token %}
                {{ form|crispy }}
                {% for formset in archivo_formset  %}
                  {% if forloop.counter <= remaining_file_count %}                        
                    {{ formset|crispy }}
                  {% endif %}              
                {% endfor %}
   <div class="modal-footer">
              <button type="submit" form="reporte-form" class="btn btn-primary">Guardar</button>
              <button type="button" class="btn btn-secondary" data-dismiss="modal">Cerrar</button>
Back to Top