code: def initialize_form(self, instance, model, data=None, extra=None):
          
          model_fields = self.get_fields_from_model(model, self._filter_fields)
  
          forms = []
          if instance:
              for field_data in instance.list_fields():
                  forms.append(
                      AdvancedFilterQueryForm._parse_query_dict(
                          field_data, model))
  
          formset = AFQFormSetNoExtra if not extra else AFQFormSet
          self.fields_formset = formset(
              data=data,
              initial=forms or None,
              model_fields=model_fields
          )
docs: Takes a "finalized" query and generate it's form data