based on Jeff Knupp tutorial for Django 1.6