code: def get_edited_object(self, request):
          
          resolvermatch = urls.resolve(request.path_info)
          if resolvermatch.namespace == 'admin' and resolvermatch.url_name and resolvermatch.url_name.endswith('_change'):
              # In "appname_modelname_change" view of the admin.
              # Extract the appname and model from the url name.
              # For some custom views, url_name might not be filled in (e.g. django-polymorphic's subclass_view)
              match = RE_CHANGE_URL.match(resolvermatch.url_name)
              if not match:
                  return None
  
              # object_id can be string (e.g. a country code as PK).
              try:
                  object_id = resolvermatch.kwargs['object_id']  # Django 2.0+
              except KeyError:
                  object_id = resolvermatch.args[0]
  
              return self.get_object_by_natural_key(match.group(1), match.group(2), object_id)
          return None
docs: Return the object which is currently being edited.
          Returns ``None`` if the match could not be made.