Fix for Django 1.4. Implemented randrange from Django 1.3.x sessions