code: def handle_dialog(self, *args, **kwargs):
          
          form = self.get_form_class()(self.request.POST, initial=kwargs, instance=self.object)
  
          success_message = None
          if form.is_valid():
              obj = form.save()
              success_message = self.success_message.format(
                  model_name=self.get_model_config().model_name.capitalize(),
                  object=str(obj),
              )
          return self.display_dialog(*args, form_instance=form, success_message=success_message, **kwargs)
docs: Handle form and save and set success message on valid form