Merge pull request #340 from Arthur-Milchior/createBackModelWithoutFullSync
Creating new basic type without doing full sync
This commit is contained in:
commit
9b1858568a
@ -10,7 +10,7 @@ models = []
|
||||
# Basic
|
||||
##########################################################################
|
||||
|
||||
def addBasicModel(col):
|
||||
def _newBasicModel(col):
|
||||
mm = col.models
|
||||
m = mm.new(_("Basic"))
|
||||
fm = mm.newField(_("Front"))
|
||||
@ -21,7 +21,11 @@ def addBasicModel(col):
|
||||
t['qfmt'] = "{{"+_("Front")+"}}"
|
||||
t['afmt'] = "{{FrontSide}}\n\n<hr id=answer>\n\n"+"{{"+_("Back")+"}}"
|
||||
mm.addTemplate(m, t)
|
||||
mm.add(m)
|
||||
return m
|
||||
|
||||
def addBasicModel(col):
|
||||
m = _newBasicModel(col)
|
||||
col.models.add(m)
|
||||
return m
|
||||
|
||||
models.append((lambda: _("Basic"), addBasicModel))
|
||||
@ -50,12 +54,13 @@ models.append((lambda: _("Basic (type in the answer)"), addBasicTypingModel))
|
||||
|
||||
def addForwardReverse(col):
|
||||
mm = col.models
|
||||
m = addBasicModel(col)
|
||||
m = _newBasicModel(col)
|
||||
m['name'] = _("Basic (and reversed card)")
|
||||
t = mm.newTemplate(_("Card 2"))
|
||||
t['qfmt'] = "{{"+_("Back")+"}}"
|
||||
t['afmt'] = "{{FrontSide}}\n\n<hr id=answer>\n\n"+"{{"+_("Front")+"}}"
|
||||
mm.addTemplate(m, t)
|
||||
mm.add(m)
|
||||
return m
|
||||
|
||||
models.append((lambda: _("Basic (and reversed card)"), addForwardReverse))
|
||||
@ -65,7 +70,7 @@ models.append((lambda: _("Basic (and reversed card)"), addForwardReverse))
|
||||
|
||||
def addForwardOptionalReverse(col):
|
||||
mm = col.models
|
||||
m = addBasicModel(col)
|
||||
m = _newBasicModel(col)
|
||||
m['name'] = _("Basic (optional reversed card)")
|
||||
av = _("Add Reverse")
|
||||
fm = mm.newField(av)
|
||||
@ -74,6 +79,7 @@ def addForwardOptionalReverse(col):
|
||||
t['qfmt'] = "{{#%s}}{{%s}}{{/%s}}" % (av, _("Back"), av)
|
||||
t['afmt'] = "{{FrontSide}}\n\n<hr id=answer>\n\n"+"{{"+_("Front")+"}}"
|
||||
mm.addTemplate(m, t)
|
||||
mm.add(m)
|
||||
return m
|
||||
|
||||
models.append((lambda: _("Basic (optional reversed card)"),
|
||||
|
Loading…
Reference in New Issue
Block a user