add tests for issue #47
fix issue #48
update manage.py to support latest django version