How to get model from string with Python Django?

To get model from string with Python Django, we can use the get_model function.

For instance, we write

from django.apps import apps

model = apps.get_model('app_name', 'model_name')

to call apps.get_model with the app name and model name as arguments to get the model.