Commit 2b2f92ae authored by Luke Plant's avatar Luke Plant
Browse files

Fixed a bug in r11646 - refs #11402

The one line of code not covered by a test... ;-)


git-svn-id: http://code.djangoproject.com/svn/django/trunk@11647 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent b79702b2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ class Manager(object):
        return self.get_query_set().only(*args, **kwargs)

    def exists(self, *args, **kwargs):
        return self.get_query_ste().exists(*args, **kwargs)
        return self.get_query_set().exists(*args, **kwargs)

    def _insert(self, values, **kwargs):
        return insert_query(self.model, values, **kwargs)
+8 −0
Original line number Diff line number Diff line
@@ -17,6 +17,10 @@ class Article(models.Model):
        return self.headline

__test__ = {'API_TESTS': r"""
# We can use .exists() to check that there are none yet
>>> Article.objects.exists()
False

# Create a couple of Articles.
>>> from datetime import datetime
>>> a1 = Article(headline='Article 1', pub_date=datetime(2005, 7, 26))
@@ -33,6 +37,10 @@ __test__ = {'API_TESTS': r"""
>>> a6.save()
>>> a7 = Article(headline='Article 7', pub_date=datetime(2005, 7, 27))
>>> a7.save()

# There should be some now!
>>> Article.objects.exists()
True
"""}

if settings.DATABASE_ENGINE in ('postgresql', 'postgresql_pysycopg2'):