Commit c8d4df46 authored by okhin's avatar okhin 🚴

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

Resolve "CSRF verification failed. (CSRF cookie when submitting forms)"

Closes #195

See merge request !203
parents 01f23e50 f94b1884
......@@ -13,6 +13,9 @@
</div>
<div class="modal-body">
{% csrf_token %}
<div class="row">
<div class="col-sm-12">
<div class="well well-sm text-justify">{% include "text/position_info.html" %}</div>
......@@ -93,4 +96,4 @@
$("#add-position-success").modal("show");
});
</script>
{% endif %}
{% endif %}
\ No newline at end of file
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('representatives_positions', '0002_multi_rep_positions'),
]
operations = [
migrations.AlterField(
model_name='position',
name='kind',
field=models.CharField(default=b'other', max_length=64, choices=[(b'other', b'Other'), (b'blog', b'Blog post'), (b'social', b'Social network'), (b'press', b'Press interview'), (b'parliament', b'Parliament debate'), (b'amendment', b'Amendment')]),
),
]
from django.views import generic
from django.views.decorators.csrf import csrf_exempt
from .forms import PositionForm
......@@ -16,11 +15,6 @@ class PositionFormMixin(generic.View):
position_form = None
position_created = False
@csrf_exempt
def dispatch(self, request, *args, **kwargs):
return super(PositionFormMixin, self).dispatch(
request, *args, **kwargs)
def post(self, request, *args, **kwargs):
if 'position-representatives' in request.POST:
self.position_form = PositionForm(request.POST, prefix='position')
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('representatives_votes', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='document',
name='chamber',
field=models.ForeignKey(related_name='documents', to='representatives.Chamber'),
),
]
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