I want to make some functions that are re-usable by any model so that I can specify the appname and model in string format and then use this to import that model and make calls to it such as creating database fields, updating, deleting, etc...
I had thought I could do this using contenttypes in Django but am trying this, as below and am getting the error message "'ContentType' object is not callable":
from django.contrib.contenttypes.models import ContentType
instancemodelname = ContentType.objects.get(app_label="myappname", model="mymodelname")
b = instancemodelname(account_username='testtestest')
b.save()
>>>>'ContentType' object is not callable
I would appreciate any advice on the proper way to do this, thanks