mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
don't break when user deletes deck with default deck as subdeck
This commit is contained in:
parent
b01f089ee1
commit
7eb2533fca
1 changed files with 6 additions and 0 deletions
|
@ -135,6 +135,12 @@ class DeckManager(object):
|
||||||
def rem(self, did, cardsToo=False, childrenToo=True):
|
def rem(self, did, cardsToo=False, childrenToo=True):
|
||||||
"Remove the deck. If cardsToo, delete any cards inside."
|
"Remove the deck. If cardsToo, delete any cards inside."
|
||||||
if str(did) == '1':
|
if str(did) == '1':
|
||||||
|
# we won't allow the default deck to be deleted, but if it's a
|
||||||
|
# child of an existing deck then it needs to be renamed
|
||||||
|
deck = self.get(did)
|
||||||
|
if '::' in deck['name']:
|
||||||
|
deck['name'] = _("Default")
|
||||||
|
self.save(deck)
|
||||||
return
|
return
|
||||||
# log the removal regardless of whether we have the deck or not
|
# log the removal regardless of whether we have the deck or not
|
||||||
self.col._logRem([did], REM_DECK)
|
self.col._logRem([did], REM_DECK)
|
||||||
|
|
Loading…
Reference in a new issue