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 bc6ca92e8c34e1a57a0ae046e3183669927d7ca9..d09a5e0befbb9decbcfaf32ca62afa807cda66c1 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 0b5e8baea1460e4acd0056673c4fd21a7926002f..ab5f19ec727b574cc845d44995d1b4371611ead7 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()