mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 16:26:40 -04:00
use libanki's new field checksum
This commit is contained in:
parent
c47e931a53
commit
d18d73b21b
1 changed files with 6 additions and 3 deletions
|
@ -7,7 +7,7 @@ from PyQt4.QtCore import *
|
||||||
from PyQt4.QtSvg import *
|
from PyQt4.QtSvg import *
|
||||||
from PyQt4.QtWebKit import QWebPage
|
from PyQt4.QtWebKit import QWebPage
|
||||||
import re, os, sys, tempfile, urllib2, ctypes
|
import re, os, sys, tempfile, urllib2, ctypes
|
||||||
from anki.utils import stripHTML, tidyHTML, canonifyTags
|
from anki.utils import stripHTML, tidyHTML, canonifyTags, fieldChecksum
|
||||||
from ankiqt.ui.sound import getAudio
|
from ankiqt.ui.sound import getAudio
|
||||||
import anki.sound
|
import anki.sound
|
||||||
from ankiqt import ui
|
from ankiqt import ui
|
||||||
|
@ -573,9 +573,12 @@ class FactEditor(object):
|
||||||
if not field.fieldModel.unique:
|
if not field.fieldModel.unique:
|
||||||
return True
|
return True
|
||||||
req = ("select value from fields "
|
req = ("select value from fields "
|
||||||
"where fieldModelId = :fmid and value = :val and id != :id")
|
"where fieldModelId = :fmid and value = :val and id != :id "
|
||||||
|
"and chksum = :chk")
|
||||||
|
val = self.textForField(field)
|
||||||
return not self.deck.s.scalar(
|
return not self.deck.s.scalar(
|
||||||
req, val=self.textForField(field), fmid=field.fieldModel.id, id=field.id)
|
req, val=val, fmid=field.fieldModel.id,
|
||||||
|
id=field.id, chk=fieldChecksum(val))
|
||||||
|
|
||||||
def onTagChange(self):
|
def onTagChange(self):
|
||||||
if not self.fact:
|
if not self.fact:
|
||||||
|
|
Loading…
Reference in a new issue