utils.module_loading.import_string()

import_string(dotted_path) [source]

Imports a dotted module path and returns the attribute/class designated by the last name in the path. Raises ImportError if the import failed. For example:

from django.utils.module_loading import import_string
ValidationError = import_string('django.core.exceptions.ValidationError')

is equivalent to:

from django.core.exceptions import ValidationError
doc_Django
2016-10-09 18:40:33
Comments
Leave a Comment

Please login to continue.