[Fixed]-Django migration like model reference

1👍

Ok figured this out my self.

from django.apps import apps
from django.db.migrations.state import ProjectState

naked_apps = ProjectState.from_apps(apps).apps
Book = naked_apps.get_model('my_app.Book')

book = Book()
book.name = 'Young Life'
book.save() 
print book.name
>> 'Young Life'

Leave a comment