From a6be59bbea62b09fb4e5aec0d59ec4eb4c0724c2 Mon Sep 17 00:00:00 2001 From: Ruud Date: Wed, 12 Feb 2014 08:16:10 +0100 Subject: [PATCH] Delete documents --- couchpotato/core/database.py | 4 +++- couchpotato/templates/database.html | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/couchpotato/core/database.py b/couchpotato/core/database.py index 0f3ece7..39c7ba1 100644 --- a/couchpotato/core/database.py +++ b/couchpotato/core/database.py @@ -60,7 +60,9 @@ class Database(object): db = self.getDB() try: - document = db.get(id) + + document_id = kwargs.get('_request').get_argument('id') + document = db.get('id', document_id) db.delete(document) return { diff --git a/couchpotato/templates/database.html b/couchpotato/templates/database.html index 6dcb35e..00ac793 100644 --- a/couchpotato/templates/database.html +++ b/couchpotato/templates/database.html @@ -55,12 +55,15 @@ (e).stop(); if(confirm('Are you sure?')){ + var a = this; new Request.JSON({ 'url': api_base + 'database.document.delete', - 'data': this.get('data-id'), + 'data': { + 'id': a.get('data-id') + }, 'onSuccess': function(){ - console.log(arguments); + a.getParent('tr').destroy(); } }).send(); }