Commit 01f23e50 authored by okhin's avatar okhin 🚴

Merge branch '195-csrf-verification-failed-csrf-cookie-when-submitting-forms' into 'master'

getting rid of csrf validation on this mixin the right way, decorating dispatch

Closes #195

See merge request !202
parents b676813b 3a42ab4a
Pipeline #1063 passed with stages
in 9 minutes and 42 seconds
...@@ -13,9 +13,6 @@ ...@@ -13,9 +13,6 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
{% csrf_token %}
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<div class="well well-sm text-justify">{% include "text/position_info.html" %}</div> <div class="well well-sm text-justify">{% include "text/position_info.html" %}</div>
...@@ -96,4 +93,4 @@ ...@@ -96,4 +93,4 @@
$("#add-position-success").modal("show"); $("#add-position-success").modal("show");
}); });
</script> </script>
{% endif %} {% endif %}
\ No newline at end of file
...@@ -17,6 +17,10 @@ class PositionFormMixin(generic.View): ...@@ -17,6 +17,10 @@ class PositionFormMixin(generic.View):
position_created = False position_created = False
@csrf_exempt @csrf_exempt
def dispatch(self, request, *args, **kwargs):
return super(PositionFormMixin, self).dispatch(
request, *args, **kwargs)
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
if 'position-representatives' in request.POST: if 'position-representatives' in request.POST:
self.position_form = PositionForm(request.POST, prefix='position') self.position_form = PositionForm(request.POST, prefix='position')
......
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