From c2df347909af5b83d69b00e898802171c7bc2454 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 20 Apr 2012 22:37:31 +0900 Subject: [PATCH] catch attempt to delete last template --- anki/models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/anki/models.py b/anki/models.py index 9d99726d4..4edc4e989 100644 --- a/anki/models.py +++ b/anki/models.py @@ -310,6 +310,7 @@ select id from cards where nid in (select id from notes where mid = ?)""", def remTemplate(self, m, template): "False if removing template would leave orphan notes." + assert len(m['tmpls']) > 1 # find cards using this template ord = m['tmpls'].index(template) cids = self.col.db.list("""