I am trying to build a query in Django dynamically. I have a lot of models that I would like to build a query for, but I don\'t want to code the name of the model, I want to
Don't try and build querysets via the QuerySet class itself. You should always go via a model's Manager.
You can get the model via the get_model
function defined in django.db.models
. It takes parameters of the app name and the model name.
from django.db.models import get_model
model = get_model('myapp', 'modelA')
model.objects.filter(**kwargs)