From 2e38174921d47d9391a7bc443b49cf3aa39fcdb7 Mon Sep 17 00:00:00 2001 From: Dave Shifflett Date: Mon, 29 Feb 2016 21:03:48 -0600 Subject: [PATCH] Cast template deck ID before checking the decks The keys of `self.decks.decks` are unicode keys whereas `template['did']` is an integer, so `template['did'] in self.decks.decks` always fails. --- anki/collection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/anki/collection.py b/anki/collection.py index d6692e5af..76e6944ff 100644 --- a/anki/collection.py +++ b/anki/collection.py @@ -380,7 +380,7 @@ insert into cards values (?,?,?,?,?,?,0,0,?,0,0,0,0,0,0,0,0,"")""", card.nid = note.id card.ord = template['ord'] # Use template did (deck override) if valid, otherwise model did - if template['did'] and template['did'] in self.decks.decks: + if template['did'] and unicode(template['did']) in self.decks.decks: card.did = template['did'] else: card.did = note.model()['did']