-
-
Save diogosimao/5c85aadfea1df85fd47097e6fdf1759c to your computer and use it in GitHub Desktop.
Example of adding Django CSRF token in an page that POSTs using intercooler.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends "custom_base.html" %} | |
{% block content %} | |
<form id="defaults" > | |
<input name="csrfmiddlewaretoken" type="hidden" value="{{ csrf_token }}"> | |
</form> | |
<table> | |
{% for row in items %} | |
<tr> | |
<td>{{ row.item }}</td> | |
<td>{{ row.category }}</td> | |
<td><button ic-include="#defaults" ic-post-to="/api/{{ row.row_type }}/{{ row.id }}/action1/">Action 1</button></td> | |
<td><button ic-include="#defaults" ic-post-to="/api/{{ row.row_type }}/{{ row.id }}/action2/">Action 2</button></td> | |
<td><button ic-include="#defaults" ic-post-to="/api/{{ row.row_type }}/{{ row.id }}/action3/">Action 3</button></td> | |
</tr> | |
{% endfor %} | |
</table> | |
{% endblock %} | |
{% block scripts %} | |
{{ block.super }} | |
<script src="{% static 'js/vendor/intercooler-0.2.0.min.js' %}"></script> | |
{% endblock %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment