summaryrefslogtreecommitdiff
path: root/media
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-03-20 15:51:02 -0500
committerDan McGee <dan@archlinux.org>2011-03-21 13:47:43 -0500
commitb9c6451f88caa35ab39b6468a99b147d7d7f4937 (patch)
tree746ac7dc1cfd9b9596e3992b33a8fdce7864111b /media
parentaca7700dd7519d45e677e18b1a0199f3712ce140 (diff)
Fix news preview with CSRF and AJAX in Django 1.2.5release_2011-03-21
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'media')
-rw-r--r--media/archweb.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/media/archweb.js b/media/archweb.js
index 52e817a4..03358fa9 100644
--- a/media/archweb.js
+++ b/media/archweb.js
@@ -71,16 +71,18 @@ if (typeof $.tablesorter !== 'undefined') {
/* news/add.html */
function enablePreview() {
- $('#previewbtn').click(function(event) {
+ $('#news-preview-button').click(function(event) {
event.preventDefault();
- $.post('/news/preview/',
- { data: $('#id_content').val() },
+ $.post('/news/preview/', {
+ data: $('#id_content').val(),
+ csrfmiddlewaretoken: $('#newsform input[name=csrfmiddlewaretoken]').val()
+ },
function(data) {
- $('#previewdata').html(data);
- $('.news-article').show();
+ $('#news-preview-data').html(data);
+ $('#news-preview').show();
}
);
- $('#previewtitle').html($('#id_title').val());
+ $('#news-preview-title').html($('#id_title').val());
});
}