From: jlaine Date: Mon, 27 Dec 2010 10:30:38 +0000 (+0000) Subject: better fix for unicity checks : implement query.has_results() X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=d148d9497b40bbfe0a1056e73e72415281f9ef9f;p=matthijs%2Fupstream%2Fdjango-ldapdb.git better fix for unicity checks : implement query.has_results() git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@966 e071eeec-0327-468d-9b6a-08194a12b294 --- diff --git a/ldapdb/models/base.py b/ldapdb/models/base.py index bc6ca92..d09a5e0 100644 --- a/ldapdb/models/base.py +++ b/ldapdb/models/base.py @@ -161,11 +161,6 @@ class Model(django.db.models.base.Model): self.saved_pk = self.pk signals.post_save.send(sender=self.__class__, instance=self, created=(not record_exists)) - def validate_unique(self, exclude=None): - # FIXME: we are bypassing the unicity checks, as they break - # the admin interface - pass - @classmethod def scoped(base_class, base_dn): """ diff --git a/ldapdb/models/query.py b/ldapdb/models/query.py index 0b5e8ba..ab5f19e 100644 --- a/ldapdb/models/query.py +++ b/ldapdb/models/query.py @@ -238,6 +238,9 @@ class Query(BaseQuery): def get_compiler(self, using=None, connection=None): return Compiler(self, ldapdb.connection, using) + def has_results(self, using): + return self.get_count() != 0 + def results_iter(self): "For django 1.1 compatibility" return self.get_compiler().results_iter()