Commit 8cc240ed authored by okhin's avatar okhin 🚴

Let's enforce csrf on home, it seems the cookie is never sent to the client...

Let's enforce csrf on home, it seems the cookie is never sent to the client only on this view. /spend 1h
parent f94b1884
......@@ -5,6 +5,8 @@ import random
from django.db.models import Q, Count
from django.views import generic
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_protect
from representatives.models import Chamber, Representative
from representatives_positions.views import PositionFormMixin
......@@ -20,6 +22,10 @@ class HomeView(PositionFormMixin, RepresentativeViewMixin,
generic.TemplateView):
template_name = 'home.html'
@method_decorator(csrf_protect)
def dispatch(self, *args, **kwargs):
return super(HomeView, self).dispatch(*args, **kwargs)
def get_context_data(self, **kwargs):
c = super(HomeView, self).get_context_data(**kwargs)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment