bruth / django-tracking2

django-tracking2 tracks the length of time visitors and registered users spend on your site. Although this will work for websites, this is more applicable to web _applications_ with registered users. This does not replace (nor intend) to replace client-side analytics which is great for understanding aggregate flow of page views.
BSD 2-Clause "Simplified" License
205 stars 67 forks source link

Django 1.4 sessions #9

Closed timbutler closed 12 years ago

timbutler commented 12 years ago

In order to use with Django 1.4, new sessions now need to be saved to the database first.

Sorry for the lack of pull request to fix, but it's a fairly simple one. Simply add the following in the middleware.py:

# If it's a new session, save it to the database first (required for Django 1.4+)    
if not request.session.session_key:
        request.session.save()

This will be before:

session_key = request.session.session_key
bruth commented 12 years ago

I uploaded the 0.1.3 release with this fix to PyPi.