(self)
Fetches metadata from DHIS2 instance and saves DHIS2 version.

        Notifies administrators if the version of DHIS2 exceeds the
        maximum supported version, but still saves and continues.
Fetches metadata from DHIS2 instance and saves DHIS2 version.
Fetches metadata from DHIS2 instance and saves DHIS2 version .
def update_dhis2_version(self):
        """
        Fetches metadata from DHIS2 instance and saves DHIS2 version.

        Notifies administrators if the version of DHIS2 exceeds the
        maximum supported version, but still saves and continues.
        """
        requests = self.connection_settings.get_requests(self)
        metadata = fetch_metadata(requests)
        dhis2_version = metadata["system"]["version"]
        try:
            get_api_version(dhis2_version)
        except Dhis2Exception as err:
            requests.notify_exception(str(err))
            raise
        if LooseVersion(dhis2_version) > DHIS2_MAX_VERSION:
            requests.notify_error(
                "Integration has not yet been tested for DHIS2 version "
                f"{dhis2_version}. Its API may not be supported."
            )
        self.dhis2_version = dhis2_version
        self.dhis2_version_last_modified = datetime.now()
        self.save()
def update_dhis2_version ( self ) : requests = self . connection_settings . get_requests ( self ) metadata = fetch_metadata ( requests ) dhis2_version = metadata [ "system" ] [ "version" ] try : get_api_version ( dhis2_version ) except Dhis2Exception as err : requests . notify_exception ( str ( err ) ) raise if LooseVersion ( dhis2_version ) > DHIS2_MAX_VERSION : requests . notify_error ( "Integration has not yet been tested for DHIS2 version " f"{dhis2_version}. Its API may not be supported." ) self . dhis2_version = dhis2_version self . dhis2_version_last_modified = datetime . now ( ) self . save ( )