remove ':' from field names
This commit is contained in:
parent
fbfb7861a2
commit
ee3f963919
@ -338,6 +338,8 @@ and notes.mid = ? and cards.ord = ?""",
|
||||
|
||||
def renameField(self, m: NoteType, field: Field, newName: Optional[str]) -> None:
|
||||
self.col.modSchema(check=True)
|
||||
if newName is not None:
|
||||
newName = newName.replace(":", "")
|
||||
pat = r"{{([^{}]*)([:#^/]|[^:#/^}][^:}]*?:|)%s}}"
|
||||
|
||||
def wrap(txt):
|
||||
|
@ -49,6 +49,7 @@ class CardLayout(QDialog):
|
||||
self.emptyFields.append(name)
|
||||
note[name] = "(%s)" % name
|
||||
note.flush()
|
||||
self.removeColons()
|
||||
self.setupTopArea()
|
||||
self.setupMainArea()
|
||||
self.setupButtons()
|
||||
@ -242,6 +243,12 @@ Please create a new card type first."""
|
||||
)
|
||||
self.redraw()
|
||||
|
||||
def removeColons(self):
|
||||
# colons in field names conflict with the template language
|
||||
for fld in self.model["flds"]:
|
||||
if ":" in fld["name"]:
|
||||
self.mm.renameField(self.model, fld, fld["name"])
|
||||
|
||||
# Buttons
|
||||
##########################################################################
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user