          vqs = Author.objects.values('name').annotate(num_books=Count('books')).filter(num_books__gt=1)
          self.assertEqual(1, len(qs))
          self.assertEqual(3, qs[0].num_books)
  
      # TODO: The phantom model does appear on Oracle.
      @no_oracle
      def test13_select_related_null_fk(self):
          "Testing `select_related` on a nullable ForeignKey via `GeoManager`. See #11381."
          no_author = Book.objects.create(title='Without Author')
 
</s> remove         # the annotation should have 3 for the number of books.
 </s> add         # the annotation should have 3 for the number of books.  Also testing
        # with a `GeoValuesQuerySet` (see #11489). </s> remove     def test12_count(self):
        "Testing `Count` aggregate use with the `GeoManager`. See #11087."
 </s> add     # TODO: fix on Oracle -- get the following error because the SQL is ordered
    # by a geometry object, which Oracle apparently doesn't like:
    #  ORA-22901: cannot compare nested table or VARRAY or LOB attributes of an object type
    @no_oracle
    def test12a_count(self):
        "Testing `Count` aggregate use with the `GeoManager` on geo-fields." </s> remove         proxied_model = opts.proxy and opts.proxy_for_model or 0
 </s> add         # Skip all proxy to the root proxied model
        proxied_model = get_proxied_model(opts)

        self.assertEqual(1, len(vqs))
        self.assertEqual(3, vqs[0]['num_books'])
          vqs = Author.objects.values('name').annotate(num_books=Count('books')).filter(num_books__gt=1)
          self.assertEqual(1, len(qs))
          self.assertEqual(3, qs[0].num_books)
        self.assertEqual(1, len(vqs))
        self.assertEqual(3, vqs[0]['num_books'])
  
      # TODO: The phantom model does appear on Oracle.
      @no_oracle
      def test13_select_related_null_fk(self):
          "Testing `select_related` on a nullable ForeignKey via `GeoManager`. See #11381."
          no_author = Book.objects.create(title='Without Author')
keep keep add keep keep keep keep keep keep
 Fixed #11489 -- `GeoQuery.resolve_columns` now recognizes annotations; disabled problematic test cases on Oracle and added notes on why.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@11251 bcc190cf-cafb-0310-a4f2-bffc1f526a37 
django/contrib/gis/tests/relatedapp/tests.py