better fix for unicity checks : implement query.has_results()
authorjlaine <jlaine@e071eeec-0327-468d-9b6a-08194a12b294>
Mon, 27 Dec 2010 10:30:38 +0000 (10:30 +0000)
committerjlaine <jlaine@e071eeec-0327-468d-9b6a-08194a12b294>
Mon, 27 Dec 2010 10:30:38 +0000 (10:30 +0000)
git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@966 e071eeec-0327-468d-9b6a-08194a12b294

ldapdb/models/base.py
ldapdb/models/query.py

index bc6ca92..d09a5e0 100644 (file)
@@ -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):
         """
index 0b5e8ba..ab5f19e 100644 (file)
@@ -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()