'+a.addText+""),m=b.find("tr:last a")):(d.filter(":last").after('"),m=d.filter(":last").next().find("a")));m.click(function(b){b.preventDefault();b=c("#"+a.prefix+"-empty");
3 | var f=b.clone(!0);f.removeClass(a.emptyCssClass).addClass(a.formCssClass).attr("id",a.prefix+"-"+l);f.is("tr")?f.children(":last").append('"):f.is("ul")||f.is("ol")?f.append(''+a.deleteText+""):f.children(":first").append(''+a.deleteText+"");f.find("*").each(function(){k(this,a.prefix,e.val())});f.insertBefore(c(b));
4 | c(e).val(parseInt(e.val(),10)+1);l+=1;""!==g.val()&&0>=g.val()-e.val()&&m.parent().hide();f.find("a."+a.deleteCssClass).click(function(b){b.preventDefault();f.remove();--l;a.removed&&a.removed(f);c(document).trigger("formset:removed",[f,a.prefix]);b=c("."+a.formCssClass);c("#id_"+a.prefix+"-TOTAL_FORMS").val(b.length);(""===g.val()||0 0) {
26 | values.push(field.val());
27 | }
28 | });
29 | prepopulatedField.val(URLify(values.join(' '), maxLength, allowUnicode));
30 | };
31 |
32 | prepopulatedField.data('_changed', false);
33 | prepopulatedField.change(function() {
34 | prepopulatedField.data('_changed', true);
35 | });
36 |
37 | if (!prepopulatedField.val()) {
38 | $(dependencies.join(',')).keyup(populate).change(populate).focus(populate);
39 | }
40 | });
41 | };
42 | })(django.jQuery);
43 |
--------------------------------------------------------------------------------
/static/admin/js/prepopulate.min.js:
--------------------------------------------------------------------------------
1 | (function(c){c.fn.prepopulate=function(e,f,g){return this.each(function(){var a=c(this),b=function(){if(!a.data("_changed")){var b=[];c.each(e,function(a,d){d=c(d);0
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/static/rest_framework/css/bootstrap-tweaks.css:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | This CSS file contains some tweaks specific to the included Bootstrap theme.
4 | It's separate from `style.css` so that it can be easily overridden by replacing
5 | a single block in the template.
6 |
7 | */
8 |
9 | .form-actions {
10 | background: transparent;
11 | border-top-color: transparent;
12 | padding-top: 0;
13 | text-align: right;
14 | }
15 |
16 | #generic-content-form textarea {
17 | font-family:Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace;
18 | font-size: 80%;
19 | }
20 |
21 | .navbar-inverse .brand a {
22 | color: #999999;
23 | }
24 | .navbar-inverse .brand:hover a {
25 | color: white;
26 | text-decoration: none;
27 | }
28 |
29 | /* custom navigation styles */
30 | .navbar {
31 | width: 100%;
32 | position: fixed;
33 | left: 0;
34 | top: 0;
35 | }
36 |
37 | .navbar {
38 | background: #2C2C2C;
39 | color: white;
40 | border: none;
41 | border-top: 5px solid #A30000;
42 | border-radius: 0px;
43 | }
44 |
45 | .navbar .nav li, .navbar .nav li a, .navbar .brand:hover {
46 | color: white;
47 | }
48 |
49 | .nav-list > .active > a, .nav-list > .active > a:hover {
50 | background: #2C2C2C;
51 | }
52 |
53 | .navbar .dropdown-menu li a, .navbar .dropdown-menu li {
54 | color: #A30000;
55 | }
56 |
57 | .navbar .dropdown-menu li a:hover {
58 | background: #EEEEEE;
59 | color: #C20000;
60 | }
61 |
62 | ul.breadcrumb {
63 | margin: 70px 0 0 0;
64 | }
65 |
66 | .breadcrumb li.active a {
67 | color: #777;
68 | }
69 |
70 | .pagination>.disabled>a,
71 | .pagination>.disabled>a:hover,
72 | .pagination>.disabled>a:focus {
73 | cursor: not-allowed;
74 | pointer-events: none;
75 | }
76 |
77 | .pager>.disabled>a,
78 | .pager>.disabled>a:hover,
79 | .pager>.disabled>a:focus {
80 | pointer-events: none;
81 | }
82 |
83 | .pager .next {
84 | margin-left: 10px;
85 | }
86 |
87 | /*=== dabapps bootstrap styles ====*/
88 |
89 | html {
90 | width:100%;
91 | background: none;
92 | }
93 |
94 | /*body, .navbar .container-fluid {
95 | max-width: 1150px;
96 | margin: 0 auto;
97 | }*/
98 |
99 | body {
100 | background: url("../img/grid.png") repeat-x;
101 | background-attachment: fixed;
102 | }
103 |
104 | #content {
105 | margin: 0;
106 | padding-bottom: 60px;
107 | }
108 |
109 | /* sticky footer and footer */
110 | html, body {
111 | height: 100%;
112 | }
113 |
114 | .wrapper {
115 | position: relative;
116 | top: 0;
117 | left: 0;
118 | padding-top: 60px;
119 | margin: -60px 0;
120 | min-height: 100%;
121 | }
122 |
123 | .form-switcher {
124 | margin-bottom: 0;
125 | }
126 |
127 | .well {
128 | -webkit-box-shadow: none;
129 | -moz-box-shadow: none;
130 | box-shadow: none;
131 | }
132 |
133 | .well .form-actions {
134 | padding-bottom: 0;
135 | margin-bottom: 0;
136 | }
137 |
138 | .well form {
139 | margin-bottom: 0;
140 | }
141 |
142 | .nav-tabs {
143 | border: 0;
144 | }
145 |
146 | .nav-tabs > li {
147 | float: right;
148 | }
149 |
150 | .nav-tabs li a {
151 | margin-right: 0;
152 | }
153 |
154 | .nav-tabs > .active > a {
155 | background: #F5F5F5;
156 | }
157 |
158 | .nav-tabs > .active > a:hover {
159 | background: #F5F5F5;
160 | }
161 |
162 | .tabbable.first-tab-active .tab-content {
163 | border-top-right-radius: 0;
164 | }
165 |
166 | footer {
167 | position: absolute;
168 | bottom: 0;
169 | left: 0;
170 | clear: both;
171 | z-index: 10;
172 | height: 60px;
173 | width: 95%;
174 | margin: 0 2.5%;
175 | }
176 |
177 | footer p {
178 | text-align: center;
179 | color: gray;
180 | border-top: 1px solid #DDDDDD;
181 | padding-top: 10px;
182 | }
183 |
184 | footer a {
185 | color: gray !important;
186 | font-weight: bold;
187 | }
188 |
189 | footer a:hover {
190 | color: gray;
191 | }
192 |
193 | .page-header {
194 | border-bottom: none;
195 | padding-bottom: 0px;
196 | margin: 0;
197 | }
198 |
199 | /* custom general page styles */
200 | .hero-unit h1, .hero-unit h2 {
201 | color: #A30000;
202 | }
203 |
204 | body a {
205 | color: #A30000;
206 | }
207 |
208 | body a:hover {
209 | color: #c20000;
210 | }
211 |
212 | .request-info {
213 | clear:both;
214 | }
215 |
216 | .horizontal-checkbox label {
217 | padding-top: 0;
218 | }
219 |
220 | .horizontal-checkbox label {
221 | padding-top: 0 !important;
222 | }
223 |
224 | .horizontal-checkbox input {
225 | float: left;
226 | width: 20px;
227 | margin-top: 3px;
228 | }
229 |
230 | .modal-footer form {
231 | margin-left: 5px;
232 | margin-right: 5px;
233 | }
234 |
--------------------------------------------------------------------------------
/static/rest_framework/css/default.css:
--------------------------------------------------------------------------------
1 |
2 | /* The navbar is fixed at >= 980px wide, so add padding to the body to prevent
3 | content running up underneath it. */
4 |
5 | h1 {
6 | font-weight: 300;
7 | }
8 |
9 | h2, h3 {
10 | font-weight: 300;
11 | }
12 |
13 | .resource-description, .response-info {
14 | margin-bottom: 2em;
15 | }
16 |
17 | .version:before {
18 | content: "v";
19 | opacity: 0.6;
20 | padding-right: 0.25em;
21 | }
22 |
23 | .version {
24 | font-size: 70%;
25 | }
26 |
27 | .format-option {
28 | font-family: Menlo, Consolas, "Andale Mono", "Lucida Console", monospace;
29 | }
30 |
31 | .button-form {
32 | float: right;
33 | margin-right: 1em;
34 | }
35 |
36 | td.nested {
37 | padding: 0 !important;
38 | }
39 |
40 | td.nested > table {
41 | margin: 0;
42 | }
43 |
44 | form select, form input, form textarea {
45 | width: 90%;
46 | }
47 |
48 | form select[multiple] {
49 | height: 150px;
50 | }
51 |
52 | /* To allow tooltips to work on disabled elements */
53 | .disabled-tooltip-shield {
54 | position: absolute;
55 | top: 0;
56 | right: 0;
57 | bottom: 0;
58 | left: 0;
59 | }
60 |
61 | .errorlist {
62 | margin-top: 0.5em;
63 | }
64 |
65 | pre {
66 | overflow: auto;
67 | word-wrap: normal;
68 | white-space: pre;
69 | font-size: 12px;
70 | }
71 |
72 | .page-header {
73 | border-bottom: none;
74 | padding-bottom: 0px;
75 | }
76 |
77 | #filtersModal form input[type=submit] {
78 | width: auto;
79 | }
80 |
81 | #filtersModal .modal-body h2 {
82 | margin-top: 0
83 | }
84 |
--------------------------------------------------------------------------------
/static/rest_framework/css/prettify.css:
--------------------------------------------------------------------------------
1 | .com { color: #93a1a1; }
2 | .lit { color: #195f91; }
3 | .pun, .opn, .clo { color: #93a1a1; }
4 | .fun { color: #dc322f; }
5 | .str, .atv { color: #D14; }
6 | .kwd, .prettyprint .tag { color: #1e347b; }
7 | .typ, .atn, .dec, .var { color: teal; }
8 | .pln { color: #48484c; }
9 |
10 | .prettyprint {
11 | padding: 8px;
12 | background-color: #f7f7f9;
13 | border: 1px solid #e1e1e8;
14 | }
15 | .prettyprint.linenums {
16 | -webkit-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
17 | -moz-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
18 | box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
19 | }
20 |
21 | /* Specify class=linenums on a pre to get line numbering */
22 | ol.linenums {
23 | margin: 0 0 0 33px; /* IE indents via margin-left */
24 | }
25 | ol.linenums li {
26 | padding-left: 12px;
27 | color: #bebec5;
28 | line-height: 20px;
29 | text-shadow: 0 1px 0 #fff;
30 | }
--------------------------------------------------------------------------------
/static/rest_framework/docs/css/base.css:
--------------------------------------------------------------------------------
1 | h1 {
2 | font-size: 45px;
3 | }
4 |
5 | .intro-code {
6 | margin-top: 20px;
7 | }
8 |
9 | pre.highlight code * {
10 | white-space: nowrap; // this sets all children inside to nowrap
11 | }
12 |
13 | pre.highlight {
14 | overflow-x: auto; // this sets the scrolling in x
15 | }
16 |
17 | pre.highlight code {
18 | white-space: pre; // forces to respect formatting
19 | }
20 |
21 | .main-container {
22 | padding-left: 30px;
23 | padding-right: 30px;
24 | }
25 |
26 | .btn:focus,
27 | .btn:focus:active {
28 | outline: none;
29 | }
30 |
31 | .sidebar {
32 | overflow: auto;
33 | font-family: verdana;
34 | font-size: 12px;
35 | font-weight: 200;
36 | background-color: #2e353d;
37 | position: fixed;
38 | top: 0px;
39 | width: 225px;
40 | height: 100%;
41 | color: #FFF;
42 | }
43 |
44 | .sidebar .brand {
45 | background-color: #23282e;
46 | display: block;
47 | text-align: center;
48 | padding: 25px 0;
49 | margin-top: 0;
50 | margin-bottom: 0;
51 | }
52 |
53 | .sidebar .brand a {
54 | color: #FFF;
55 | }
56 |
57 | .sidebar .brand a:hover,
58 | .sidebar .brand a:active,
59 | .sidebar .brand a:focus {
60 | text-decoration: none;
61 | }
62 |
63 | .sidebar .toggle-btn {
64 | display: none;
65 | }
66 |
67 | .sidebar .menu-list {
68 | width: inherit;
69 | }
70 |
71 | .sidebar .menu-list ul,
72 | .sidebar .menu-list li {
73 | background: #2e353d;
74 | list-style: none;
75 | padding: 0px;
76 | margin: 0px;
77 | line-height: 35px;
78 | cursor: pointer;
79 | }
80 |
81 | .sidebar .menu-list ul :not(collapsed) .arrow:before,
82 | .sidebar .menu-list li :not(collapsed) .arrow:before {
83 | font-family: FontAwesome;
84 | content: "\f078";
85 | display: inline-block;
86 | padding-left: 10px;
87 | padding-right: 10px;
88 | vertical-align: middle;
89 | float: right;
90 | }
91 |
92 | .sidebar .menu-list ul .active,
93 | .sidebar .menu-list li .active {
94 | border-left: 3px solid #d19b3d;
95 | background-color: #4f5b69;
96 | }
97 |
98 | .sidebar .menu-list ul .sub-menu li.active,
99 | .sidebar .menu-list li .sub-menu li.active {
100 | color: #d19b3d;
101 | }
102 |
103 | .sidebar .menu-list ul .sub-menu li.active a,
104 | .sidebar .menu-list li .sub-menu li.active a {
105 | color: #d19b3d;
106 | }
107 |
108 | .sidebar .menu-list ul .sub-menu li,
109 | .sidebar .menu-list li .sub-menu li {
110 | background-color: #181c20;
111 | border: none;
112 | border-bottom: 1px solid #23282e;
113 | margin-left: 0px;
114 | text-indent: 10px;
115 | }
116 |
117 | .sidebar .menu-list ul .sub-menu li:hover,
118 | .sidebar .menu-list li .sub-menu li:hover {
119 | background-color: #020203;
120 | }
121 |
122 |
123 | .sidebar .menu-list ul .sub-menu li a,
124 | .sidebar .menu-list li .sub-menu li a {
125 | display: block;
126 | }
127 |
128 | .sidebar .menu-list ul .sub-menu li a:before,
129 | .sidebar .menu-list li .sub-menu li a:before {
130 | font-family: FontAwesome;
131 | content: "\f105";
132 | display: inline-block;
133 | padding-left: 10px;
134 | padding-right: 10px;
135 | vertical-align: middle;
136 | }
137 |
138 | .sidebar .menu-list li {
139 | padding-left: 0px;
140 | border-left: 3px solid #2e353d;
141 | border-bottom: 1px solid #23282e;
142 | }
143 |
144 | .sidebar .menu-list li a {
145 | text-decoration: none;
146 | color: white;
147 | }
148 |
149 | .sidebar .menu-list li a i {
150 | padding-left: 10px;
151 | width: 20px;
152 | padding-right: 20px;
153 | }
154 |
155 | .sidebar .menu-list li:hover {
156 | border-left: 3px solid #d19b3d;
157 | background-color: #4f5b69;
158 | -webkit-transition: all 1s ease;
159 | -moz-transition: all 1s ease;
160 | -o-transition: all 1s ease;
161 | -ms-transition: all 1s ease;
162 | transition: all 1s ease;
163 | }
164 |
165 | body {
166 | margin: 0px;
167 | padding: 0px;
168 | }
169 |
170 | .coredocs-section-title {
171 | margin-top: 20px;
172 | padding-bottom: 10px;
173 | border-bottom: 1px solid lightgrey;
174 | }
175 |
176 | .coredocs-link-title a,
177 | .coredocs-section-title a {
178 | display: none;
179 | }
180 |
181 | .coredocs-link-title a,
182 | .coredocs-section-title a {
183 | text-decoration: none;
184 | }
185 |
186 | .coredocs-link-title:hover a,
187 | .coredocs-section-title:hover a {
188 | display: inline;
189 | font-size: 20px;
190 | }
191 |
192 | .coredocs-section-title:last-child {
193 | margin-top: 0;
194 | }
195 |
196 |
197 | /* @group Language Switcher */
198 |
199 | .sidebar .menu-list.menu-list-bottom {
200 | margin-bottom: 0;
201 | position: fixed;
202 | width: inherit;
203 | bottom: 0;
204 | left: 0;
205 | right: 0;
206 | border-top: 1px solid #23282e;
207 | }
208 |
209 | .sidebar .menu-list-bottom li span {
210 | float: right;
211 | margin-right: 20px;
212 | color: #d19b3d;
213 | }
214 |
215 | /* @end Language Switcher */
216 |
217 |
218 | /* @group Docs Content */
219 |
220 | .docs-content .meta .label {
221 | vertical-align: middle;
222 | font-size: 14px;
223 | font-weight: normal;
224 | }
225 |
226 | .docs-content .meta code {
227 | vertical-align: middle;
228 | padding: .2em .6em .3em;
229 | font-size: 14px;
230 | }
231 |
232 | .docs-content .btn {
233 | font-size: inherit;
234 | }
235 |
236 | .code-samples pre {
237 | margin-top: 20px;
238 | }
239 |
240 | /* @end Docs Content */
241 |
242 |
243 | @media (max-width: 767px) {
244 | .main-container {
245 | padding-left: 15px;
246 | padding-right: 15px;
247 | }
248 |
249 | .sidebar {
250 | position: relative;
251 | width: 100%;
252 | margin-bottom: 10px;
253 | overflow: visible;
254 | }
255 |
256 | .sidebar .toggle-btn {
257 | display: block;
258 | cursor: pointer;
259 | position: absolute;
260 | right: 10px;
261 | top: 10px;
262 | z-index: 10 !important;
263 | padding: 3px;
264 | width: 40px;
265 | text-align: center;
266 | }
267 |
268 | .sidebar .menu-list.menu-list-bottom {
269 | position: static;
270 | }
271 |
272 | .sidebar .brand {
273 | margin-top: 0;
274 | margin-bottom: 0;
275 |
276 | text-align: left !important;
277 | font-size: 22px;
278 | padding: 0;
279 | padding-left: 20px;
280 | line-height: 50px !important;
281 | }
282 | }
283 |
284 | @media (min-width: 767px) {
285 | .sidebar .menu-list .menu-content {
286 | display: block;
287 | }
288 | #main {
289 | width:calc(100% - 225px);
290 | float: right;
291 | }
292 | }
293 |
294 | @media (min-width: 992px) {
295 | .modal-lg {
296 | width: 980px;
297 | }
298 | }
299 |
300 | .api-modal .modal-title .fa {
301 | color: #93c54b;
302 | }
303 |
304 | .api-modal .modal-body .request-awaiting {
305 | padding: 35px 10px;
306 | color: #7F8177;
307 | text-align: center;
308 | }
309 |
310 | .api-modal .modal-body .meta {
311 | margin-bottom: 20px;
312 | }
313 |
314 | .api-modal .modal-body .meta .label {
315 | vertical-align: middle;
316 | font-size: 14px;
317 | font-weight: normal;
318 | }
319 |
320 | .api-modal .modal-body .meta code {
321 | vertical-align: middle;
322 | padding: .2em .6em .3em;
323 | font-size: 14px;
324 | }
325 |
326 | .api-modal .modal-content .toggle-view {
327 | text-align: right;
328 | float: right;
329 | }
330 |
331 | .api-modal .modal-content .response .well {
332 | margin: 0;
333 | max-height: 550px;
334 | }
335 |
336 | .highlight {
337 | background-color: #f7f7f9
338 | }
339 |
340 | .checkbox label.control-label {
341 | font-weight: bold
342 | }
343 |
344 | @media (min-width: 768px) {
345 | .navbar-nav.navbar-right:last-child {
346 | margin-right: 0 !important;
347 | }
348 | }
349 |
--------------------------------------------------------------------------------
/static/rest_framework/docs/css/highlight.css:
--------------------------------------------------------------------------------
1 | /*
2 | This is the GitHub theme for highlight.js
3 |
4 | github.com style (c) Vasily Polovnyov
5 |
6 | */
7 |
8 | .hljs {
9 | display: block;
10 | overflow-x: auto;
11 | padding: 0.5em;
12 | color: #333;
13 | -webkit-text-size-adjust: none;
14 | }
15 |
16 | .hljs-comment,
17 | .diff .hljs-header,
18 | .hljs-javadoc {
19 | color: #998;
20 | font-style: italic;
21 | }
22 |
23 | .hljs-keyword,
24 | .css .rule .hljs-keyword,
25 | .hljs-winutils,
26 | .nginx .hljs-title,
27 | .hljs-subst,
28 | .hljs-request,
29 | .hljs-status {
30 | color: #333;
31 | font-weight: bold;
32 | }
33 |
34 | .hljs-number,
35 | .hljs-hexcolor,
36 | .ruby .hljs-constant {
37 | color: #008080;
38 | }
39 |
40 | .hljs-string,
41 | .hljs-tag .hljs-value,
42 | .hljs-phpdoc,
43 | .hljs-dartdoc,
44 | .tex .hljs-formula {
45 | color: #d14;
46 | }
47 |
48 | .hljs-title,
49 | .hljs-id,
50 | .scss .hljs-preprocessor {
51 | color: #900;
52 | font-weight: bold;
53 | }
54 |
55 | .hljs-list .hljs-keyword,
56 | .hljs-subst {
57 | font-weight: normal;
58 | }
59 |
60 | .hljs-class .hljs-title,
61 | .hljs-type,
62 | .vhdl .hljs-literal,
63 | .tex .hljs-command {
64 | color: #458;
65 | font-weight: bold;
66 | }
67 |
68 | .hljs-tag,
69 | .hljs-tag .hljs-title,
70 | .hljs-rule .hljs-property,
71 | .django .hljs-tag .hljs-keyword {
72 | color: #000080;
73 | font-weight: normal;
74 | }
75 |
76 | .hljs-attribute,
77 | .hljs-variable,
78 | .lisp .hljs-body,
79 | .hljs-name {
80 | color: #008080;
81 | }
82 |
83 | .hljs-regexp {
84 | color: #009926;
85 | }
86 |
87 | .hljs-symbol,
88 | .ruby .hljs-symbol .hljs-string,
89 | .lisp .hljs-keyword,
90 | .clojure .hljs-keyword,
91 | .scheme .hljs-keyword,
92 | .tex .hljs-special,
93 | .hljs-prompt {
94 | color: #990073;
95 | }
96 |
97 | .hljs-built_in {
98 | color: #0086b3;
99 | }
100 |
101 | .hljs-preprocessor,
102 | .hljs-pragma,
103 | .hljs-pi,
104 | .hljs-doctype,
105 | .hljs-shebang,
106 | .hljs-cdata {
107 | color: #999;
108 | font-weight: bold;
109 | }
110 |
111 | .hljs-deletion {
112 | background: #fdd;
113 | }
114 |
115 | .hljs-addition {
116 | background: #dfd;
117 | }
118 |
119 | .diff .hljs-change {
120 | background: #0086b3;
121 | }
122 |
123 | .hljs-chunk {
124 | color: #aaa;
125 | }
126 |
--------------------------------------------------------------------------------
/static/rest_framework/docs/css/jquery.json-view.min.css:
--------------------------------------------------------------------------------
1 | .json-view{position:relative}
2 | .json-view .collapser{width:20px;height:18px;display:block;position:absolute;left:-1.7em;top:-.2em;z-index:5;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAD1JREFUeNpiYGBgOADE%2F3Hgw0DM4IRHgSsDFOzFInmMAQnY49ONzZRjDFiADT7dMLALiE8y4AGW6LoBAgwAuIkf%2F%2FB7O9sAAAAASUVORK5CYII%3D);background-repeat:no-repeat;background-position:center center;opacity:.5;cursor:pointer}
3 | .json-view .collapsed{-ms-transform:rotate(-90deg);-moz-transform:rotate(-90deg);-khtml-transform:rotate(-90deg);-webkit-transform:rotate(-90deg);-o-transform:rotate(-90deg);transform:rotate(-90deg)}
4 | .json-view .bl{display:block;padding-left:20px;margin-left:-20px;position:relative}
5 | .json-view{font-family:monospace}
6 | .json-view ul{list-style-type:none;padding-left:2em;border-left:1px dotted;margin:.3em}
7 | .json-view ul li{position:relative}
8 | .json-view .comments,.json-view .dots{display:none;-moz-user-select:none;-ms-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;user-select:none}
9 | .json-view .comments{padding-left:.8em;font-style:italic;color:#888}
10 | .json-view .bool,.json-view .null,.json-view .num,.json-view .undef{font-weight:700;color:#1A01CC}
11 | .json-view .str{color:#800}
--------------------------------------------------------------------------------
/static/rest_framework/docs/fonts/fontawesome-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ovkulkarni/sis-api/4516a5867533f3e59df02bf17915b49ecccb0375/static/rest_framework/docs/fonts/fontawesome-webfont.eot
--------------------------------------------------------------------------------
/static/rest_framework/docs/fonts/fontawesome-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ovkulkarni/sis-api/4516a5867533f3e59df02bf17915b49ecccb0375/static/rest_framework/docs/fonts/fontawesome-webfont.ttf
--------------------------------------------------------------------------------
/static/rest_framework/docs/fonts/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ovkulkarni/sis-api/4516a5867533f3e59df02bf17915b49ecccb0375/static/rest_framework/docs/fonts/fontawesome-webfont.woff
--------------------------------------------------------------------------------
/static/rest_framework/docs/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ovkulkarni/sis-api/4516a5867533f3e59df02bf17915b49ecccb0375/static/rest_framework/docs/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/static/rest_framework/docs/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ovkulkarni/sis-api/4516a5867533f3e59df02bf17915b49ecccb0375/static/rest_framework/docs/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/static/rest_framework/docs/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ovkulkarni/sis-api/4516a5867533f3e59df02bf17915b49ecccb0375/static/rest_framework/docs/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/static/rest_framework/docs/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ovkulkarni/sis-api/4516a5867533f3e59df02bf17915b49ecccb0375/static/rest_framework/docs/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/static/rest_framework/docs/img/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ovkulkarni/sis-api/4516a5867533f3e59df02bf17915b49ecccb0375/static/rest_framework/docs/img/favicon.ico
--------------------------------------------------------------------------------
/static/rest_framework/docs/img/grid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ovkulkarni/sis-api/4516a5867533f3e59df02bf17915b49ecccb0375/static/rest_framework/docs/img/grid.png
--------------------------------------------------------------------------------
/static/rest_framework/docs/js/api.js:
--------------------------------------------------------------------------------
1 | var responseDisplay = 'data'
2 | var coreapi = window.coreapi
3 | var schema = window.schema
4 |
5 | function normalizeKeys (arr) {
6 | var _normarr = [];
7 | for (var i = 0; i < arr.length; i++) {
8 | _normarr = _normarr.concat(arr[i].split(' > '));
9 | }
10 | return _normarr;
11 | }
12 |
13 | function normalizeHTTPHeader (str) {
14 | // Capitalize HTTP headers for display.
15 | return (str.charAt(0).toUpperCase() + str.substring(1))
16 | .replace(/-(.)/g, function ($1) {
17 | return $1.toUpperCase()
18 | })
19 | .replace(/(Www)/g, function ($1) {
20 | return 'WWW'
21 | })
22 | .replace(/(Xss)/g, function ($1) {
23 | return 'XSS'
24 | })
25 | .replace(/(Md5)/g, function ($1) {
26 | return 'MD5'
27 | })
28 | }
29 |
30 | function formEntries (form) {
31 | // Polyfill for new FormData(form).entries()
32 | var formData = new FormData(form)
33 | if (formData.entries !== undefined) {
34 | return Array.from(formData.entries())
35 | }
36 |
37 | var entries = []
38 |
39 | for (var i = 0; i < form.elements.length; i++) {
40 | var element = form.elements[i]
41 |
42 | if (!element.name) {
43 | continue
44 | }
45 |
46 | if (element.type === 'file') {
47 | for (var j = 0; j < element.files.length; j++) {
48 | entries.push([element.name, element.files[j]])
49 | }
50 | } else if (element.type === 'select-multiple' || element.type === 'select-one') {
51 | for (var j = 0; j < element.selectedOptions.length; j++) {
52 | entries.push([element.name, element.selectedOptions[j].value])
53 | }
54 | } else if (element.type === 'checkbox') {
55 | if (element.checked) {
56 | entries.push([element.name, element.value])
57 | }
58 | } else {
59 | entries.push([element.name, element.value])
60 | }
61 | }
62 |
63 | return entries
64 | }
65 |
66 | $(function () {
67 | var $selectedAuthentication = $('#selected-authentication')
68 | var $authControl = $('#auth-control')
69 | var $authTokenModal = $('#auth_token_modal')
70 | var $authBasicModal = $('#auth_basic_modal')
71 | var $authSessionModal = $('#auth_session_modal')
72 |
73 | // Language Control
74 | $('#language-control li').click(function (event) {
75 | event.preventDefault()
76 | var $languageMenuItem = $(this).find('a')
77 | var $languageControls = $(this).closest('ul').find('li')
78 | var $languageControlLinks = $languageControls.find('a')
79 | var language = $languageMenuItem.data('language')
80 |
81 | $languageControlLinks.not('[data-language="' + language + '"]').parent().removeClass('active')
82 | $languageControlLinks.filter('[data-language="' + language + '"]').parent().addClass('active')
83 |
84 | $('#selected-language').text(language)
85 |
86 | var $codeBlocks = $('pre.highlight')
87 | $codeBlocks.not('[data-language="' + language + '"]').addClass('hide')
88 | $codeBlocks.filter('[data-language="' + language + '"]').removeClass('hide')
89 | })
90 |
91 | // API Explorer
92 | $('form.api-interaction').submit(function (event) {
93 | event.preventDefault()
94 |
95 | var $form = $(this).closest('form')
96 | var $requestMethod = $form.find('.request-method')
97 | var $requestUrl = $form.find('.request-url')
98 | var $toggleView = $form.closest('.modal-content').find('.toggle-view')
99 | var $responseStatusCode = $form.find('.response-status-code')
100 | var $meta = $form.find('.meta')
101 | var $responseRawResponse = $form.find('.response-raw-response')
102 | var $requestAwaiting = $form.find('.request-awaiting')
103 | var $responseRaw = $form.find('.response-raw')
104 | var $responseData = $form.find('.response-data')
105 | var key = normalizeKeys($form.data('key'))
106 | var params = {}
107 | var entries = formEntries($form.get()[0])
108 |
109 | for (var i = 0; i < entries.length; i++) {
110 | var entry = entries[i]
111 | var paramKey = entry[0]
112 | var paramValue = entry[1]
113 | var $elem = $form.find('[name="' + paramKey + '"]')
114 | var dataType = $elem.data('type') || 'string'
115 |
116 | if (dataType === 'integer' && paramValue) {
117 | var value = parseInt(paramValue)
118 | if (!isNaN(value)) {
119 | params[paramKey] = value
120 | }
121 | } else if (dataType === 'number' && paramValue) {
122 | var value = parseFloat(paramValue)
123 | if (!isNaN(value)) {
124 | params[paramKey] = value
125 | }
126 | } else if (dataType === 'boolean' && paramValue) {
127 | var value = {
128 | 'true': true,
129 | 'false': false
130 | }[paramValue.toLowerCase()]
131 | if (value !== undefined) {
132 | params[paramKey] = value
133 | }
134 | } else if (dataType === 'array' && paramValue) {
135 | try {
136 | params[paramKey] = JSON.parse(paramValue)
137 | } catch (err) {
138 | // Ignore malformed JSON
139 | }
140 | } else if (dataType === 'object' && paramValue) {
141 | try {
142 | params[paramKey] = JSON.parse(paramValue)
143 | } catch (err) {
144 | // Ignore malformed JSON
145 | }
146 | } else if (dataType === 'string' && paramValue) {
147 | params[paramKey] = paramValue
148 | }
149 | }
150 |
151 | $form.find(':checkbox').each(function (index) {
152 | // Handle unselected checkboxes
153 | var name = $(this).attr('name')
154 | if (!params.hasOwnProperty(name)) {
155 | params[name] = false
156 | }
157 | })
158 |
159 | function requestCallback (request) {
160 | // Fill in the "GET /foo/" display.
161 | var parser = document.createElement('a')
162 | parser.href = request.url
163 | var method = request.options.method
164 | var path = parser.pathname + parser.hash + parser.search
165 |
166 | $requestMethod.text(method)
167 | $requestUrl.text(path)
168 | }
169 |
170 | function responseCallback (response, responseText) {
171 | // Display the 'Data'/'Raw' control.
172 | $toggleView.removeClass('hide')
173 |
174 | // Fill in the "200 OK" display.
175 | $responseStatusCode.removeClass('label-success').removeClass('label-danger')
176 | if (response.ok) {
177 | $responseStatusCode.addClass('label-success')
178 | } else {
179 | $responseStatusCode.addClass('label-danger')
180 | }
181 | $responseStatusCode.text(response.status)
182 | $meta.removeClass('hide')
183 |
184 | // Fill in the Raw HTTP response display.
185 | var panelText = 'HTTP/1.1 ' + response.status + ' ' + response.statusText + '\n'
186 | response.headers.forEach(function (header, key) {
187 | panelText += normalizeHTTPHeader(key) + ': ' + header + '\n'
188 | })
189 | if (responseText) {
190 | panelText += '\n' + responseText
191 | }
192 | $responseRawResponse.text(panelText)
193 | }
194 |
195 | // Instantiate a client to make the outgoing request.
196 | var options = {
197 | requestCallback: requestCallback,
198 | responseCallback: responseCallback
199 | }
200 |
201 | // Setup authentication options.
202 | if (window.auth && window.auth.type === 'token') {
203 | // Header authentication
204 | options.auth = new coreapi.auth.TokenAuthentication({
205 | scheme: window.auth.scheme,
206 | token: window.auth.token
207 | })
208 | } else if (window.auth && window.auth.type === 'basic') {
209 | // Basic authentication
210 | options.auth = new coreapi.auth.BasicAuthentication({
211 | username: window.auth.username,
212 | password: window.auth.password
213 | })
214 | } else if (window.auth && window.auth.type === 'session') {
215 | // Session authentication
216 | options.auth = new coreapi.auth.SessionAuthentication({
217 | csrfCookieName: 'csrftoken',
218 | csrfHeaderName: 'X-CSRFToken'
219 | })
220 | }
221 |
222 | var client = new coreapi.Client(options)
223 | client.action(schema, key, params).then(function (data) {
224 | var response = JSON.stringify(data, null, 2)
225 | $requestAwaiting.addClass('hide')
226 | $responseRaw.addClass('hide')
227 | $responseData.addClass('hide').text('').jsonView(response)
228 |
229 | if (responseDisplay === 'data') {
230 | $responseData.removeClass('hide')
231 | } else {
232 | $responseRaw.removeClass('hide')
233 | }
234 | }).catch(function (error) {
235 | var response = JSON.stringify(error.content, null, 2)
236 | $requestAwaiting.addClass('hide')
237 | $responseRaw.addClass('hide')
238 | $responseData.addClass('hide').text('').jsonView(response)
239 |
240 | if (responseDisplay === 'data') {
241 | $responseData.removeClass('hide')
242 | } else {
243 | $responseRaw.removeClass('hide')
244 | }
245 | })
246 | })
247 |
248 | // 'Data'/'Raw' control
249 | $('.toggle-view button').click(function () {
250 | var $modalContent = $(this).closest('.modal-content')
251 | var $modalResponseRaw = $modalContent.find('.response-raw')
252 | var $modalResponseData = $modalContent.find('.response-data')
253 |
254 | responseDisplay = $(this).data('display-toggle')
255 |
256 | $(this).removeClass('btn-default').addClass('btn-info').siblings().removeClass('btn-info')
257 |
258 | if (responseDisplay === 'raw') {
259 | $modalResponseRaw.removeClass('hide')
260 | $modalResponseData.addClass('hide')
261 | } else {
262 | $modalResponseData.removeClass('hide')
263 | $modalResponseRaw.addClass('hide')
264 | }
265 | })
266 |
267 | // Authentication: none
268 | $authControl.find("[data-auth='none']").click(function (event) {
269 | event.preventDefault()
270 | window.auth = null
271 | $selectedAuthentication.text('none')
272 | $authControl.find("[data-auth]").closest('li').removeClass('active')
273 | $authControl.find("[data-auth='none']").closest('li').addClass('active')
274 | })
275 |
276 | // Authentication: token
277 | $('form.authentication-token-form').submit(function (event) {
278 | event.preventDefault()
279 | var $form = $(this).closest('form')
280 | var scheme = $form.find('input#scheme').val()
281 | var token = $form.find('input#token').val()
282 | window.auth = {
283 | 'type': 'token',
284 | 'scheme': scheme,
285 | 'token': token
286 | }
287 | $selectedAuthentication.text('token')
288 | $authControl.find("[data-auth]").closest('li').removeClass('active')
289 | $authControl.find("[data-auth='token']").closest('li').addClass('active')
290 | $authTokenModal.modal('hide')
291 | })
292 |
293 | // Authentication: basic
294 | $('form.authentication-basic-form').submit(function (event) {
295 | event.preventDefault()
296 | var $form = $(this).closest('form')
297 | var username = $form.find('input#username').val()
298 | var password = $form.find('input#password').val()
299 | window.auth = {
300 | 'type': 'basic',
301 | 'username': username,
302 | 'password': password
303 | }
304 | $selectedAuthentication.text('basic')
305 | $authControl.find("[data-auth]").closest('li').removeClass('active')
306 | $authControl.find("[data-auth='basic']").closest('li').addClass('active')
307 | $authBasicModal.modal('hide')
308 | })
309 |
310 | // Authentication: session
311 | $('form.authentication-session-form').submit(function (event) {
312 | event.preventDefault()
313 | window.auth = {
314 | 'type': 'session'
315 | }
316 | $selectedAuthentication.text('session')
317 | $authControl.find("[data-auth]").closest('li').removeClass('active')
318 | $authControl.find("[data-auth='session']").closest('li').addClass('active')
319 | $authSessionModal.modal('hide')
320 | })
321 | })
322 |
--------------------------------------------------------------------------------
/static/rest_framework/docs/js/jquery.json-view.min.js:
--------------------------------------------------------------------------------
1 | /**
2 | * jquery.json-view - jQuery collapsible JSON plugin
3 | * @version v1.0.0
4 | * @link http://github.com/bazh/jquery.json-view
5 | * @license MIT
6 | */
7 | !function(e){"use strict";var n=function(n){var a=e("",{"class":"collapser",on:{click:function(){var n=e(this);n.toggleClass("collapsed");var a=n.parent().children(".block"),p=a.children("ul");n.hasClass("collapsed")?(p.hide(),a.children(".dots, .comments").show()):(p.show(),a.children(".dots, .comments").hide())}}});return n&&a.addClass("collapsed"),a},a=function(a,p){var t=e.extend({},{nl2br:!0},p),r=function(e){return e.toString()?e.toString().replace(/&/g,"&").replace(/"/g,""").replace(//g,">"):""},s=function(n,a){return e("",{"class":a,html:r(n)})},l=function(a,p){switch(e.type(a)){case"object":p||(p=0);var c=e("",{"class":"block"}),d=Object.keys(a).length;if(!d)return c.append(s("{","b")).append(" ").append(s("}","b"));c.append(s("{","b"));var i=e("",{"class":"obj collapsible level"+p});return e.each(a,function(a,t){d--;var r=e("").append(s('"',"q")).append(a).append(s('"',"q")).append(": ").append(l(t,p+1));-1===["object","array"].indexOf(e.type(t))||e.isEmptyObject(t)||r.prepend(n()),d>0&&r.append(","),i.append(r)}),c.append(i),c.append(s("...","dots")),c.append(s("}","b")),c.append(1===Object.keys(a).length?s("// 1 item","comments"):s("// "+Object.keys(a).length+" items","comments")),c;case"array":p||(p=0);var d=a.length,c=e("",{"class":"block"});if(!d)return c.append(s("[","b")).append(" ").append(s("]","b"));c.append(s("[","b"));var i=e("",{"class":"obj collapsible level"+p});return e.each(a,function(a,t){d--;var r=e("").append(l(t,p+1));-1===["object","array"].indexOf(e.type(t))||e.isEmptyObject(t)||r.prepend(n()),d>0&&r.append(","),i.append(r)}),c.append(i),c.append(s("...","dots")),c.append(s("]","b")),c.append(1===a.length?s("// 1 item","comments"):s("// "+a.length+" items","comments")),c;case"string":if(a=r(a),/^(http|https|file):\/\/[^\s]+$/i.test(a))return e("").append(s('"',"q")).append(e("",{href:a,text:a})).append(s('"',"q"));if(t.nl2br){var o=/\n/g;o.test(a)&&(a=(a+"").replace(o," "))}var u=e("",{"class":"str"}).html(a);return e("").append(s('"',"q")).append(u).append(s('"',"q"));case"number":return s(a.toString(),"num");case"undefined":return s("undefined","undef");case"null":return s("null","null");case"boolean":return s(a?"true":"false","bool")}};return l(a)};return e.fn.jsonView=function(n,p){var t=e(this);if(p=e.extend({},{nl2br:!0},p),"string"==typeof n)try{n=JSON.parse(n)}catch(r){}return t.append(e("",{"class":"json-view"}).append(a(n,p))),t}}(jQuery);
--------------------------------------------------------------------------------
/static/rest_framework/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ovkulkarni/sis-api/4516a5867533f3e59df02bf17915b49ecccb0375/static/rest_framework/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/static/rest_framework/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ovkulkarni/sis-api/4516a5867533f3e59df02bf17915b49ecccb0375/static/rest_framework/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/static/rest_framework/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ovkulkarni/sis-api/4516a5867533f3e59df02bf17915b49ecccb0375/static/rest_framework/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/static/rest_framework/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ovkulkarni/sis-api/4516a5867533f3e59df02bf17915b49ecccb0375/static/rest_framework/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/static/rest_framework/img/glyphicons-halflings-white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ovkulkarni/sis-api/4516a5867533f3e59df02bf17915b49ecccb0375/static/rest_framework/img/glyphicons-halflings-white.png
--------------------------------------------------------------------------------
/static/rest_framework/img/glyphicons-halflings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ovkulkarni/sis-api/4516a5867533f3e59df02bf17915b49ecccb0375/static/rest_framework/img/glyphicons-halflings.png
--------------------------------------------------------------------------------
/static/rest_framework/img/grid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ovkulkarni/sis-api/4516a5867533f3e59df02bf17915b49ecccb0375/static/rest_framework/img/grid.png
--------------------------------------------------------------------------------
/static/rest_framework/js/ajax-form.js:
--------------------------------------------------------------------------------
1 | function replaceDocument(docString) {
2 | var doc = document.open("text/html");
3 |
4 | doc.write(docString);
5 | doc.close();
6 | }
7 |
8 | function doAjaxSubmit(e) {
9 | var form = $(this);
10 | var btn = $(this.clk);
11 | var method = (
12 | btn.data('method') ||
13 | form.data('method') ||
14 | form.attr('method') || 'GET'
15 | ).toUpperCase();
16 |
17 | if (method === 'GET') {
18 | // GET requests can always use standard form submits.
19 | return;
20 | }
21 |
22 | var contentType =
23 | form.find('input[data-override="content-type"]').val() ||
24 | form.find('select[data-override="content-type"] option:selected').text();
25 |
26 | if (method === 'POST' && !contentType) {
27 | // POST requests can use standard form submits, unless we have
28 | // overridden the content type.
29 | return;
30 | }
31 |
32 | // At this point we need to make an AJAX form submission.
33 | e.preventDefault();
34 |
35 | var url = form.attr('action');
36 | var data;
37 |
38 | if (contentType) {
39 | data = form.find('[data-override="content"]').val() || ''
40 |
41 | if (contentType === 'multipart/form-data') {
42 | // We need to add a boundary parameter to the header
43 | // We assume the first valid-looking boundary line in the body is correct
44 | // regex is from RFC 2046 appendix A
45 | var boundaryCharNoSpace = "0-9A-Z'()+_,-./:=?";
46 | var boundaryChar = boundaryCharNoSpace + ' ';
47 | var re = new RegExp('^--([' + boundaryChar + ']{0,69}[' + boundaryCharNoSpace + '])[\\s]*?$', 'im');
48 | var boundary = data.match(re);
49 | if (boundary !== null) {
50 | contentType += '; boundary="' + boundary[1] + '"';
51 | }
52 | // Fix textarea.value EOL normalisation (multipart/form-data should use CR+NL, not NL)
53 | data = data.replace(/\n/g, '\r\n');
54 | }
55 | } else {
56 | contentType = form.attr('enctype') || form.attr('encoding')
57 |
58 | if (contentType === 'multipart/form-data') {
59 | if (!window.FormData) {
60 | alert('Your browser does not support AJAX multipart form submissions');
61 | return;
62 | }
63 |
64 | // Use the FormData API and allow the content type to be set automatically,
65 | // so it includes the boundary string.
66 | // See https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects
67 | contentType = false;
68 | data = new FormData(form[0]);
69 | } else {
70 | contentType = 'application/x-www-form-urlencoded; charset=UTF-8'
71 | data = form.serialize();
72 | }
73 | }
74 |
75 | var ret = $.ajax({
76 | url: url,
77 | method: method,
78 | data: data,
79 | contentType: contentType,
80 | processData: false,
81 | headers: {
82 | 'Accept': 'text/html; q=1.0, */*'
83 | },
84 | });
85 |
86 | ret.always(function(data, textStatus, jqXHR) {
87 | if (textStatus != 'success') {
88 | jqXHR = data;
89 | }
90 |
91 | var responseContentType = jqXHR.getResponseHeader("content-type") || "";
92 |
93 | if (responseContentType.toLowerCase().indexOf('text/html') === 0) {
94 | replaceDocument(jqXHR.responseText);
95 |
96 | try {
97 | // Modify the location and scroll to top, as if after page load.
98 | history.replaceState({}, '', url);
99 | scroll(0, 0);
100 | } catch (err) {
101 | // History API not supported, so redirect.
102 | window.location = url;
103 | }
104 | } else {
105 | // Not HTML content. We can't open this directly, so redirect.
106 | window.location = url;
107 | }
108 | });
109 |
110 | return ret;
111 | }
112 |
113 | function captureSubmittingElement(e) {
114 | var target = e.target;
115 | var form = this;
116 |
117 | form.clk = target;
118 | }
119 |
120 | $.fn.ajaxForm = function() {
121 | var options = {}
122 |
123 | return this
124 | .unbind('submit.form-plugin click.form-plugin')
125 | .bind('submit.form-plugin', options, doAjaxSubmit)
126 | .bind('click.form-plugin', options, captureSubmittingElement);
127 | };
128 |
--------------------------------------------------------------------------------
/static/rest_framework/js/csrf.js:
--------------------------------------------------------------------------------
1 | function getCookie(name) {
2 | var cookieValue = null;
3 |
4 | if (document.cookie && document.cookie != '') {
5 | var cookies = document.cookie.split(';');
6 |
7 | for (var i = 0; i < cookies.length; i++) {
8 | var cookie = jQuery.trim(cookies[i]);
9 |
10 | // Does this cookie string begin with the name we want?
11 | if (cookie.substring(0, name.length + 1) == (name + '=')) {
12 | cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
13 | break;
14 | }
15 | }
16 | }
17 |
18 | return cookieValue;
19 | }
20 |
21 | function csrfSafeMethod(method) {
22 | // these HTTP methods do not require CSRF protection
23 | return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
24 | }
25 |
26 | function sameOrigin(url) {
27 | // test that a given url is a same-origin URL
28 | // url could be relative or scheme relative or absolute
29 | var host = document.location.host; // host + port
30 | var protocol = document.location.protocol;
31 | var sr_origin = '//' + host;
32 | var origin = protocol + sr_origin;
33 |
34 | // Allow absolute or scheme relative URLs to same origin
35 | return (url == origin || url.slice(0, origin.length + 1) == origin + '/') ||
36 | (url == sr_origin || url.slice(0, sr_origin.length + 1) == sr_origin + '/') ||
37 | // or any other URL that isn't scheme relative or absolute i.e relative.
38 | !(/^(\/\/|http:|https:).*/.test(url));
39 | }
40 |
41 | var csrftoken = getCookie(window.drf.csrfCookieName);
42 |
43 | $.ajaxSetup({
44 | beforeSend: function(xhr, settings) {
45 | if (!csrfSafeMethod(settings.type) && sameOrigin(settings.url)) {
46 | // Send the token to same-origin, relative URLs only.
47 | // Send the token only if the method warrants CSRF protection
48 | // Using the CSRFToken value acquired earlier
49 | xhr.setRequestHeader(window.drf.csrfHeaderName, csrftoken);
50 | }
51 | }
52 | });
53 |
--------------------------------------------------------------------------------
/static/rest_framework/js/default.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function() {
2 | // JSON highlighting.
3 | prettyPrint();
4 |
5 | // Bootstrap tooltips.
6 | $('.js-tooltip').tooltip({
7 | delay: 1000,
8 | container: 'body'
9 | });
10 |
11 | // Deal with rounded tab styling after tab clicks.
12 | $('a[data-toggle="tab"]:first').on('shown', function(e) {
13 | $(e.target).parents('.tabbable').addClass('first-tab-active');
14 | });
15 |
16 | $('a[data-toggle="tab"]:not(:first)').on('shown', function(e) {
17 | $(e.target).parents('.tabbable').removeClass('first-tab-active');
18 | });
19 |
20 | $('a[data-toggle="tab"]').click(function() {
21 | document.cookie = "tabstyle=" + this.name + "; path=/";
22 | });
23 |
24 | // Store tab preference in cookies & display appropriate tab on load.
25 | var selectedTab = null;
26 | var selectedTabName = getCookie('tabstyle');
27 |
28 | if (selectedTabName) {
29 | selectedTabName = selectedTabName.replace(/[^a-z-]/g, '');
30 | }
31 |
32 | if (selectedTabName) {
33 | selectedTab = $('.form-switcher a[name=' + selectedTabName + ']');
34 | }
35 |
36 | if (selectedTab && selectedTab.length > 0) {
37 | // Display whichever tab is selected.
38 | selectedTab.tab('show');
39 | } else {
40 | // If no tab selected, display rightmost tab.
41 | $('.form-switcher a:first').tab('show');
42 | }
43 |
44 | $(window).load(function() {
45 | $('#errorModal').modal('show');
46 | });
47 | });
48 |
--------------------------------------------------------------------------------
|