Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Use get_model() from django.apps to fix incompatibility with django-q #27

Open
jordanmkoncz opened this issue Dec 13, 2017 · 1 comment · May be fixed by #41
Open

Use get_model() from django.apps to fix incompatibility with django-q #27

jordanmkoncz opened this issue Dec 13, 2017 · 1 comment · May be fixed by #41

Comments

@jordanmkoncz
Copy link

So this is a bit of a weird issue. I have been using django-openinghours in a project for a while and not having any issues, and today I was working on integrating https://github.com/Koed00/django-q into the project.

For some reason, django-openinghours and django-q are not compatible with each other, and as soon as I add django_q to my INSTALLED_APPS in my project's settings.py, I get the following error when trying to load any page in the Django Admin:

Traceback:

File "/Users/jordan/Development/my_project/venv/lib/python3.5/site-packages/django/template/utils.py" in __getitem__
  65.             return self._engines[alias]

During handling of the above exception ('django'), another exception occurred:

File "/Users/jordan/Development/my_project/venv/lib/python3.5/site-packages/django/template/backends/django.py" in get_package_libraries
  126.             module = import_module(entry[1])

File "/Users/jordan/Development/my_project/venv/lib/python3.5/importlib/__init__.py" in import_module
  126.     return _bootstrap._gcd_import(name[level:], package, level)

File "/Users/jordan/Development/my_project/venv/lib/python3.5/site-packages/openinghours/templatetags/openinghours_tags.py" in <module>
  6. from openinghours import utils

File "/Users/jordan/Development/my_project/venv/lib/python3.5/site-packages/openinghours/utils.py" in <module>
  9. from compat import get_model

Exception Type: InvalidTemplateLibrary at /admin/login/
Exception Value: Invalid template library specified. ImportError raised when trying to load 'openinghours.templatetags.openinghours_tags': cannot import name 'get_model'

If I remove django_q from my INSTALLED_APPS, the error goes away and everything works fine again, but then I can't use django-q obviously, so I've managed to find another solution. If I update the django-openinghours code to use get_model() from django.apps instead of get_model() from compat, I no longer get this InvalidTemplateLibrary exception and both django-openinghours and django-q work correctly. I have created a fork of django-openinghours which has this fix, which you can see at jordanmkoncz@4e23d45. Note that this fork was done from the v0.1.3 commit, as this is the version currently published to PyPI and the one I have been using in my project.

@jordanmkoncz
Copy link
Author

jordanmkoncz commented Jan 15, 2018

Any updates on this @arteria or @walterrenner?

@fmalina fmalina linked a pull request Dec 16, 2019 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant