code: def form_valid_bridge(self, form, field, model, related_field, error_message):
          
          # get instance of selected external object
          external = form.cleaned_data[field]
          object_edit = model.objects.get(pk=form.instance.pk)
          if object_edit.external == external:
              answer = super(GenUpdateBridge, self).form_valid(form)
          else:
              related_object = get_external_model(model).objects.filter(**{
                  "pk": external.pk,
                  "{}__isnull".format(related_field): False
              }).exclude(**{
                  "{}".format(related_field): form.instance,
              }).first()
              if not related_object:
                  # form valid
                  try:
                      with transaction.atomic():
                          result = super(GenUpdateBridge, self).form_valid(form)
                          field = object_edit.external
                          setattr(field, related_field, None)
                          field.save()
                          setattr(external, related_field, form.instance)
                          external.save()
                      # Return success url
                      answer = HttpResponseRedirect(self.get_success_url())
                  except CodenerixException:
                      answer = super(GenUpdateBridge, self).form_invalid(form)
              else:
                  errors = form._errors.setdefault(field, ErrorList())
                  errors.append(error_message[0])
                  answer = super(GenUpdateBridge, self).form_invalid(form)
  
          # Return result
          return answer
docs: call from form_valid.
          @form: it is form of form_valid (type: form)
          @field: name of the form field referring to the brigde (type: string)
          @model: form's model (type class)
          @related_field: name of the related_name of the brigde (type: string)
          @error_message: list of message errors (type list)
              one item, example:
              ["The selected entry is not available anymore, please, try again!", ]