django-dash doesn't work with Django 1.7
tgs opened this issue · 5 comments
The main issue I found is that it fails during Django's setup. In 1.7, apparently, one is not supposed to call get_user_model() in module-level code. Here is a backtrace:
File "/home/smithtg/src/crm-dashboard/env/lib/python3.3/site-packages/dash/models.py", line 20, in <module>
from dash.compat import User
File "/home/smithtg/src/crm-dashboard/env/lib/python3.3/site-packages/dash/compat.py", line 13, in <module>
User = get_user_model()
File "/home/smithtg/src/crm-dashboard/env/lib/python3.3/site-packages/django/contrib/auth/__init__.py", line 136, in get_user_model
return django_apps.get_model(settings.AUTH_USER_MODEL)
File "/home/smithtg/src/crm-dashboard/env/lib/python3.3/site-packages/django/apps/registry.py", line 199, in get_model
self.check_models_ready()
File "/home/smithtg/src/crm-dashboard/env/lib/python3.3/site-packages/django/apps/registry.py", line 131, in check_models_ready
raise AppRegistryNotReady("Models aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.
I worked around this by changing src/dash/compat.py to read:
__all__ = ('User',)
from django.conf import settings
User = settings.AUTH_USER_MODEL
I imagine that this breaks some old versions of Django, but I haven't tested. If you're interested in a pull request, I might have time to try it out.
Hey, thanks much for reporting this.
I've started to work on Django 1.7 compatibility. So far, it does seem to work with some tiny tricks. I need to spend some more time on it though, in order to prepare a new release.
I'll post updates on the issue right here.
This should be properly documented (a TODO), but master branch does work for me in Django 1.7.
See the following files:
- https://github.com/barseghyanartur/django-dash/blob/master/example/freeze_django17.txt
- https://github.com/barseghyanartur/django-dash/blob/master/example/example/settings_django17.py
No apps that are incompatible with Django 1.7 should be listed in the settings.py.
What for the example project, that comes with django-dash, the only difference is that django-registration has been replaced with django-registration-redux, which works fine with Django 1.7 as well.
No release has been made yet, since there's some work to do still, but that's what works already.
Thank you for the quickness of your response! I'll try out your changes today.
Hey, I was wondering if it worked for you. Did it?
Hey, I've just released a new version 0.4.8 (PyPI updated too). All automated tests and tests that I have made with 3-rd party apps passed. With several dependencies updated and tiny changes to settings, it works just fine.
- https://github.com/barseghyanartur/django-dash/blob/master/example/example/settings_django17.py
- https://github.com/barseghyanartur/django-dash/blob/master/test_django17.sh
I'm closing this issue. If you get any problems regarding the 1.7 support, please open a new issue.