Merge pull request #117 from timrae/override

Don't use default deck when deck override set to invalid deck
This commit is contained in:
Damien Elmes 2016-02-22 09:25:48 +10:00
commit 5dca0cdf77

View File

@ -379,7 +379,11 @@ insert into cards values (?,?,?,?,?,?,0,0,?,0,0,0,0,0,0,0,0,"")""",
card = anki.cards.Card(self)
card.nid = note.id
card.ord = template['ord']
card.did = template['did'] or note.model()['did']
# Use template did (deck override) if valid, otherwise model did
if template['did'] and template['did'] in self.decks.decks:
card.did = template['did']
else:
card.did = note.model()['did']
# if invalid did, use default instead
deck = self.decks.get(card.did)
if deck['dyn']: