mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 16:26:40 -04:00
copy fields in order, not by name, when changing models
This commit is contained in:
parent
fa800946b6
commit
add79296a8
1 changed files with 6 additions and 5 deletions
|
@ -75,12 +75,13 @@ class AddCards(QDialog):
|
||||||
fact = self.parent.deck.newFact()
|
fact = self.parent.deck.newFact()
|
||||||
# copy fields from old fact
|
# copy fields from old fact
|
||||||
if oldFact:
|
if oldFact:
|
||||||
for field in oldFact.model.fieldModels:
|
n = 0
|
||||||
|
for field in fact.fields:
|
||||||
try:
|
try:
|
||||||
fact[field.name]
|
field.value = oldFact.fields[n].value
|
||||||
fact[field.name] = oldFact[field.name]
|
except IndexError:
|
||||||
except KeyError:
|
break
|
||||||
pass
|
n += 1
|
||||||
fact.tags = oldFact.tags
|
fact.tags = oldFact.tags
|
||||||
else:
|
else:
|
||||||
fact.tags = self.parent.deck.lastTags
|
fact.tags = self.parent.deck.lastTags
|
||||||
|
|
Loading…
Reference in a new issue