From aef7626557bc2abc2941aac51f8a130ef66849f0 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 7 Nov 2011 14:27:15 +0900 Subject: [PATCH] add fieldNames(); fix scmhash() --- anki/models.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/anki/models.py b/anki/models.py index 4d29a5c9d..8aaf91b2d 100644 --- a/anki/models.py +++ b/anki/models.py @@ -248,6 +248,9 @@ select id from cards where fid in (select id from facts where mid = ?)""", "Mapping of field name -> (ord, field)." return dict((f['name'], (f['ord'], f)) for f in m['flds']) + def fieldNames(self, m): + return [f['name'] for f in m['flds']] + def sortIdx(self, m): return m['sortf'] @@ -430,6 +433,7 @@ select id from facts where mid = ?)""" % " ".join(map), def scmhash(self, m): "Return a hash of the schema, to see if models are compatible." + s = "" for f in m['flds']: s += f['name'] return fieldChecksum(s)