From b942fc8f7a7684e005e31a3055fef089c7ca84fc Mon Sep 17 00:00:00 2001 From: Tim Nyborg Date: Thu, 3 Dec 2015 15:02:21 +0000 Subject: [PATCH] Fix IS_NOT_IN_DB to work with custom primarykey Validator currently selects custom id properly, but then explicitly checks .id --- gluon/validators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gluon/validators.py b/gluon/validators.py index 73c1f5ca..e5b9887a 100644 --- a/gluon/validators.py +++ b/gluon/validators.py @@ -694,7 +694,7 @@ class IS_NOT_IN_DB(Validator): return (value, translate(self.error_message)) else: row = subset.select(table._id, field, limitby=(0, 1), orderby_on_limitby=False).first() - if row and str(row.id) != str(id): + if row and str(row[table._id]) != str(id): return (value, translate(self.error_message)) return (value, None)