pablorecio/django-qrcode

Runtime error on django 1.9

Opened this issue · 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 !

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.