django-qrcode icon indicating copy to clipboard operation
django-qrcode copied to clipboard

Runtime error on django 1.9

Open olivierdalang opened this issue 9 years ago • 1 comments

Hi,

Thanks for the awesome library !

Here it doesn't work well under django 1.9. I get :

RuntimeError at /accounts/login/
Model class django.contrib.sites.models.Site doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

The faulty line is /home/olivier/virtualenvs/UrbaDatabase/lib/python3.4/site-packages/qrcode/templatetags/qr_tags.py in <module>

from django.contrib.sites.models import Site 

It is fixable by adding django.contrib.sites to the installed apps, but I don't think such a dependency is justified.

Thanks !

olivierdalang avatar Apr 15 '16 01:04 olivierdalang

So, what about removing that dependency ?

This would mean removing the qr_from_object tag. But I think this function isn't generic enough : it supposes that the site module is used, that obj.get_absolute_url is defined, and that the protocol is http. And all of this for an extremely trivial function.

olivierdalang avatar Jun 08 '16 13:06 olivierdalang