Closed adrysn closed 7 years ago
So how can I solve it?
Current solution would be to keep using old style middleware settings https://docs.djangoproject.com/en/1.10/ref/settings/#std:setting-MIDDLEWARE_CLASSES
MIDDLEWARE_CLASSES = [
...
'django_user_agents.middleware.UserAgentMiddleware',
]
It will be removed in the future Django versions though.
You can do this to use it in the new MIDDLEWARE style:
class NewUserAgentMiddleware(MiddlewareMixin, UserAgentMiddleware):
pass
Then just reference that class in MIDDLEWARE.
UserAgentMiddleware is not working with Django 1.10. If it is inserted into the list of middlewares in settings file, an error occurs such as below.
This error is probably due to the changed style of middleware introduced in Django 1.10: https://docs.djangoproject.com/en/1.10/topics/http/middleware/.
The middleware class should be updated to comply with the new style.
For the moment, one can replace
object
toMiddlewareMixin
to enable the middleware.