Updated for django version 1.6.