Fix indentation in __init__
Refactor the Django view code