Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

django.db.models.get_model is deprecated #6

Closed
sheppard opened this issue May 5, 2015 · 5 comments
Closed

django.db.models.get_model is deprecated #6

sheppard opened this issue May 5, 2015 · 5 comments

Comments

@sheppard
Copy link
Collaborator

sheppard commented May 5, 2015

The alias will be dropped in Django 1.9. Just need to update swapper.load_model to use django.db.models.loading.get_model instead.

@mauritsvanrees
Copy link

Using django.db.models.loading.get_model gets you a second deprecation warning, so this does not help. But it points in the right direction. The loading module has the pointers to the new locations. So you can look in loading.py to see where you should import it from. In this case you should use django.apps.apps.get_model.

Note: I am not using the django-swappable-models project, but this is currently the top link when Googling for django.db.models.get_model is deprecated. :-)

@sheppard
Copy link
Collaborator Author

Thanks for the heads up!

jproffitt pushed a commit to jproffitt/django-swappable-models that referenced this issue Sep 2, 2015
sheppard added a commit that referenced this issue Sep 2, 2015
Fixing RemovedInDjango19Warning related to get_model. fixes issue #6
@sheppard
Copy link
Collaborator Author

sheppard commented Sep 2, 2015

Fixed in #9

@42force
Copy link

42force commented Mar 18, 2019

Hi, has this been resolved?

@mauritsvanrees
Copy link

Yes, according to the above comment this was fixed more than three years ago in pull request #9. Looking at the commit this was added already in swapper version 0.3.0.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants