SLICEPLUS_API = "/xoslib/slicesplus/";
+ function getCookie(name) {
+ var cookieValue = null;\r
+ if (document.cookie && document.cookie != '') {\r
+ var cookies = document.cookie.split(';');\r
+ for (var i = 0; i < cookies.length; i++) {\r
+ var cookie = jQuery.trim(cookies[i]);\r
+ // Does this cookie string begin with the name we want?\r
+ if (cookie.substring(0, name.length + 1) == (name + '=')) {\r
+ cookieValue = decodeURIComponent(cookie.substring(name.length + 1));\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ return cookieValue;\r
+ }
+
XOSModel = Backbone.Model.extend({
/* from backbone-tastypie.js */
//idAttribute: 'resource_uri',
var _sync = Backbone.sync;\r
Backbone.sync = function(method, model, options){\r
options.beforeSend = function(xhr){\r
- var token = $('meta[name="csrf-token"]').attr('content');\r
+ //var token = $('meta[name="csrf-token"]').attr('content');\r
+ var token = getCookie("csrftoken");\r
xhr.setRequestHeader('X-CSRFToken', token);\r
console.log(token);\r
};\r
<html lang="{{ LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
<head>
<title>{% block title %} {%if title %} {{ title }} | {% endif %} {{ 'ADMIN_NAME'|suit_conf }}{% endblock %}</title>
- <meta name="csrf-token" content="{{csrf_token}}">
<link rel="stylesheet" type="text/css" href="{% block stylesheet %}{% endblock %}"/>
<link rel="stylesheet" type="text/css" href="{% static 'suit/bootstrap/css/bootstrap.min.css' %}" media="all"/>
<link rel="stylesheet" type="text/css" href="{% static 'suit/css/suit.css' %}" media="all">