mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
set default deck on upgrade; append old deck name to model
This commit is contained in:
parent
5333165c8d
commit
47a170898a
1 changed files with 5 additions and 0 deletions
|
@ -117,6 +117,11 @@ class Anki2Importer(Importer):
|
||||||
# if it doesn't exist, we'll copy it over, preserving id
|
# if it doesn't exist, we'll copy it over, preserving id
|
||||||
if not self.dst.models.have(mid):
|
if not self.dst.models.have(mid):
|
||||||
self.dst.models.update(src)
|
self.dst.models.update(src)
|
||||||
|
# if we're importing with a prefix, make the model default to it
|
||||||
|
if self.deckPrefix:
|
||||||
|
src['did'] = self.dst.decks.current()['id']
|
||||||
|
# and give it a unique name
|
||||||
|
src['name'] += " (%s)" % self.deckPrefix
|
||||||
# make sure to bump usn
|
# make sure to bump usn
|
||||||
self.dst.models.save(src)
|
self.dst.models.save(src)
|
||||||
self._modelMap[mid] = mid
|
self._modelMap[mid] = mid
|
||||||
|
|
Loading…
Reference in a new issue